use CacheMe\Cache; use CacheMe\Drivers\Memory; // Create a new cache instance $cache = new Cache(new Memory()); // Store a value in cache for 1 hour $cache->store('foo', 'bar', 3600); // Retrieve the cached value $value = $cache->get('foo'); echo $value; // Output: bar
use CacheMe\Cache; use CacheMe\Drivers\File; // Create a new cache instance with the data directory of "/path/to/data" $cache = new Cache(new File('/path/to/data')); // Store a value in cache for 1 hour $cache->store('foo', 'bar', 3600); // Retrieve the cached value $value = $cache->get('foo'); echo $value; // Output: barIn this example, we create a new cache instance using the `File` driver and specify the path to the data directory. We then store a value with a key of `foo` and a TTL of 1 hour, retrieve the cached value using the `get()` method, and output it. Package Library: CacheMe is not part of any package library, it is a standalone PHP library that can be downloaded from GitHub or installed using Composer.