Skip to content

heheheheheehyqo/cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cache

Packagist Version Packagist PHP Version Support GitHub Workflow Status

Install

composer require hyqo/cache

Usage

use Hyqo\Cache\Layer\FilesystemLayer;
use Hyqo\Cache\CacheItem

$cache = new FilesystemLayer('namespace', /*lifetime*/0, 'cache_dir');
$item = $cache->getItem('key', function () {
    return 'ageless cache';
});

$item = $cache->getItem('key', function (\Hyqo\Cache\CacheItem $cacheItem) {
    $cacheItem->setExpiresAfter(60);

    return 'value will be expired after 60 seconds';
});

//expected cache key creation unix time
$item = $cache->getItemCreatedAfter(12345678, 'key', function (\Hyqo\Cache\CacheItem $cacheItem) {
    $cacheItem->setExpiresAfter(60);

    return 'value will be expired after 60 seconds';
});

$value = $item->get();

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages