Skip to content

flrnull/php-tagged-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

PHP Tagged Cache | Simply improves cache system

This class helps to validate cache with tagging approach. If you want to set dependency for some value in cache, you may specify array of needed keys as it dependencies.

Usage example

use \TaggedCache\CacheStorageTest;
use \TaggedCache\Cache;

$storage = new CacheStorageTest();
$cache = new Cache($storage);

$key1 = 'foo';
$value1 = 10;
$key2 = 'bar';
$value2 = 15;

// Store first param
$cache->set($key1, $value1);

// Store second param  with dependency to first param
$cache->setDependencies(array($key1));
$cache->set($key2, $value2);

// All should be ok now
assert($cache->get($key2) === $value2);

// Now we change first param and check again
usleep(2000); // We use accuracy 1 millisecond in CacheStorageTest
$cache->set($key1, 9);
assert($cache->get($key2) === false);

About

Cache class with dependencies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages