Popularity
0.7
Stable
Activity
0.0
Stable
2
2
2

Programming language: PHP
License: MIT License
Tags: Caching     PHP7     Cache    
Latest version: v1.1.1

PHP Simple Cache alternatives and similar libraries

Based on the "Caching" category.
Alternatively, view PHP Simple Cache alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of PHP Simple Cache or a related project?

Add another 'Caching' Library

README

simple-cache

Simple PHP object caching base on temp file

Packagist Packagist Travis Scrutinizer Codecov Packagist FOSSA Status

Installation

$ composer require jaredchu/simple-cache

Usage

Quick start
use JC\Cache\SimpleCache;

// store your object
SimpleCache::add('your-key', new Person('Jared', 27));

// check if exists
SimpleCache::exists('your-key');

// fetch your object
$person = SimpleCache::fetch('your-key', Person::class);

// remove your cache
SimpleCache::remove('your-key');
Add
// cache object Person with lifetime 1000 seconds (default is 0, not expire)
SimpleCache::add('your-key', new Person('Jared', 27), 1000);
Fetch
if(SimpleCache::exists('your-key')){
  $person = SimpleCache::fetch('your-key', Person::class);
  $person->sayHi();
}
Remove
SimpleCache::remove('your-key');
Security
// your data is already encrypt but you can set your own encrypt key
SimpleCache::setEncryptKey('your unique string');
SimpleCache::add('your-key', new Person('Jared', 27));

// you must set encrypt key again if you want to call fetch in another session
SimpleCache::setEncryptKey('your unique string');
$person = SimpleCache::fetch('your-key', Person::class);

Contributing

  1. Fork it!
  2. Create your feature branch: $ git checkout -b feature/your-new-feature
  3. Commit your changes: $ git commit -am 'Add some feature'
  4. Push to the branch: $ git push origin feature/your-new-feature
  5. Submit a pull request.

License

MIT License

FOSSA Status


*Note that all licence references and agreements mentioned in the PHP Simple Cache README section above are relevant to that project's source code only.