cookiecache
Cache beyond the edge with cookies!
This library provides a distributed PSR-16 compatible cache implementation for PHP 6 that uses browser cookies to store data, saving HUNDREDS of valuable bytes of server memory.
Installation
composer require colinodell/cookiecache
Problems installing? Check out this helpful guide.
Usage
use ColinODell\CookieCache\CookieCache;
$cache = new CookieCache();
$cache->set('foo', 'bar', 3600);
assert($cache->get('foo') === 'bar');
It's that easy!
Limitations
Because of the nature of cookies, this library is not suitable for storing large amounts of data. If you need to store more than 4096 bytes of data per entry, consider using a different library.
Also note that each visitor will have a separate copy of cached items. This is probably not useful.
Also, note that these cookies are not encrypted, so a malicious user can read and modify the contents of the cache, potentially causing unexpected and undesired results.
License
This library is released under the April Fools Public License.
FAQs
- Does this really work? I mean, the tests pass, so... probably?
- Should I use this? Absolutely not.
- Why not? Because it has a known deserialization vulnerability.