[go: up one dir, main page]

Skip to content

Common interface for various caching methods for PHP5

License

Notifications You must be signed in to change notification settings

milenvoutchev/phpCache

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhpCache

PhpCache is object PHP >=5 cache wrapper that offers similar way of handling various caching mechanisms:

  • APC (deprecated)
  • Memcached
  • Redis
  • Filesystem (deprecated)
  • Session (deprecated)
  • Variable (temporary, not available between requests)

#Example usage

require_once 'PhpCache.php';
\PhpCache\PhpCache::$sDefaultMechanism = 'Redis';
$cache = \PhpCache\Factory::getInstance()->create();

$key = new \PhpCache\CacheKey('myKey');
$cache->set($key, 'Lorem ipsum');
if ($cache->check($key)) {
    var_dump($cache->get($key));
} else {
    var_dump('Data not found');
}

#Methods available for all caching mechanisms:

  • set - sets cache value based on provided key
  • get - get data from cache based on provided key. Returns false when no data for key
  • check - checks if data for provided key is set
  • clear - removed data for key
  • clearAll - flushes cache

About

Common interface for various caching methods for PHP5

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 80.5%
  • Shell 19.5%