Download the PHP package nickjbedford/tagcache without Composer

On this page you can find all versions of the php package nickjbedford/tagcache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tagcache

TagCache

TagCache is a PHP data and text file-based caching library designed to make it simple to generate and store serialized data and text/HTML content for highly efficient retrieval when paired with high-performance memory-cached file systems such as on Linux. Cache retrieval times (including deserialization) can be submillisecond on modern SSD-based infrastructure using native file systems.

Cache names are created based on tagged keys, such as object type/ID or date ranges, making it easy to manage and invalidate caches as needed. Symbolic links are used to create a tag-based directory structure for easy clearing of canonical cache files.

Cache keys are created from a specific name combined with tags againsts objects or dates related to that cache. When an object is updated, all canonical cache files related to that object can be cleared easily via the symlink directory structure.

For example:

A cache key named "row-listing" related to "order #123" and "account #21" would create the canonical cache file of feb9ed37caf09e97ec0f49f65fccad64.cache which is typically stored as its md5 hash :

Performance Characteristics

The following performance benchmarks are based on tests run on an 2020 iMac Retina 5K with the following specifications:

Development Workstation

Amazon EC2 Web Server

Cache Retrieval (Hit)

TagCache is optimized for read-heavy workloads where cache retrieval speed is critical. By leveraging modern file systems and fast storage, the cache retrieval process involves the following steps:

  1. Construct the cache key declaration.
  2. Generate the canonical MD5 cache key and full path.
  3. Check if the file exists.
  4. Check if the existing file modification time is within the valid cache duration.
  5. Acquire a shared lock on the file for reading.
  6. Read the file contents into a string variable.
  7. Close the file and release the lock.
  8. Deserialize the string into an object (if required).

This entire process for a small multi-property PHP object can take as little as 20-30 microseconds (including deserialization) when the operating system has the file cached in memory. See tests/PerformanceTests.php for benchmarks.

Cache Generation (Miss)

Cache generation introduces some overhead due to the need to create symbolic links as well as write the cache file. The process involves the following steps:

  1. Construct the cache key declaration.
  2. Generate the canonical MD5 cache key and full path.
  3. Acquire an exclusive lock on the file to be cached, to prevent race conditions.
  4. Generate and serialize the data value to be cached using the supplied generator callable.
  5. Write the serialized data to the cache file.
  6. Close the file and release the lock.
  7. For each tag, create the necessary directories and symbolic links to the cache file.

Despite all of these steps, cache storage and symbolic link creation can still be performed in as low as 0.5 milliseconds (500μs) for a small multi-property PHP object on modern SSD-based infrastructure with a modern file system. See tests/PerformanceTests.php for benchmarks.

Benchmark Results

The benchmark generates between 5000-5100 randomised cache files for testing cache hits. Each file is then read back in a loop to measure performance. This ensures that the operating system has the files cached in memory, simulating a real-world scenario where frequently accessed cache files are kept in memory by the OS. See tests/PerformanceTests.php for the benchmark code.

The results are as follows:

Development Workstation

Amazon EC2 Web Server

File Locking

TagCache uses file locking to ensure data integrity during cache writes. Shared locks are used for reading cache files, while exclusive locks are used for writing. This prevents race conditions and ensures that cache files are not corrupted during concurrent access. It also ensures that multiple processes do not attempt to generate the same cache simultaneously, which could lead to redundant work and potential inconsistencies.

Lock acquisition is performed using a non-blocking call to allow for a default timeout period of 30 seconds. This means that if a process cannot acquire the lock within this timeframe, it will fail gracefully rather than hanging indefinitely.


All versions of tagcache with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nickjbedford/tagcache contains the following files

Loading the files please wait ...