Distributed PSR-16 cache implementation for PHP 6 that uses browser cookies to store data

Overview

cookiecache

Latest Version Total Downloads Software License Build Status Quality Score Sponsor development of this project

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.
You might also like...
PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.
PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

Donate/Support: Documentation: https://www.scrapbook.cash - API reference: https://docs.scrapbook.cash Table of contents Installation & usage Adapters

:zap: Simple Cache Abstraction Layer for PHP

⚡ Simple Cache Class This is a simple Cache Abstraction Layer for PHP = 7.0 that provides a simple interaction with your cache-server. You can define

Elephant - a highly performant PHP Cache Driver for Kirby 3

🐘 Kirby3 PHP Cache-Driver Elephant - a highly performant PHP Cache Driver for Kirby 3 Commerical Usage Support open source! This plugin is free but i

PHP local cache

__ ____ _________ ______/ /_ ___ / __ \/ ___/ __ `/ ___/ __ \/ _ \ / /_/ / /__/ /_/ / /__/ / / / __/ / ._

PHP Cache Duration
PHP Cache Duration

PHP Cache Duration Introduction A readable and fluent way to generate PHP cache time. Built and written by Ajimoti Ibukun Quick Samples Instead of thi

Simple artisan command to debug your redis cache. Requires PHP 8.1 & Laravel 9
Simple artisan command to debug your redis cache. Requires PHP 8.1 & Laravel 9

🔎 php artisan cache:debug Simple artisan command to debug your redis cache 🚀 Installation You can install the package via composer: composer require

The place to keep your cache.

Stash - A PHP Caching Library Stash makes it easy to speed up your code by caching the results of expensive functions or code. Certain actions, like d

Cache slam defense using a semaphore to prevent dogpile effect.

metaphore PHP cache slam defense using a semaphore to prevent dogpile effect (aka clobbering updates, stampending herd or Slashdot effect). Problem: t

Doctrine Cache component

Doctrine Cache Cache component extracted from the Doctrine Common project. Documentation This library is deprecated and will no longer receive bug fix

Owner
Colin O'Dell
Senior Software Engineer at @wayfair. @thephpleague leadership team. Baltimore PHP co-organizer. International conference speaker. PHP 7 Upgrade Guide author.
Colin O'Dell
A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache tagging and indexing.

Apix Cache, cache-tagging for PHP Apix Cache is a generic and thin cache wrapper with a PSR-6 interface to various caching backends and emphasising ca

Apix 111 Nov 26, 2022
Simple cache abstraction layer implementing PSR-16

sabre/cache This repository is a simple abstraction layer for key-value caches. It implements PSR-16. If you need a super-simple way to support PSR-16

sabre.io 48 Sep 9, 2022
This is a Symfony bundle that lets you you integrate your PSR-6 compliant cache service with the framework

PSR-6 Cache bundle This is a Symfony bundle that lets you you integrate your PSR-6 compliant cache service with the framework. It lets you cache your

null 43 Oct 7, 2021
PSR-15 middleware with various cache utilities

middlewares/cache Middleware components with the following cache utilities: CachePrevention Expires Cache Requirements PHP >= 7.2 A PSR-7 http library

Middlewares 15 Oct 25, 2022
LRU Cache implementation in PHP

PHP LRU Cache implementation Intro WTF is a LRU Cache? LRU stands for Least Recently Used. It's a type of cache that usually has a fixed capacity and

Rogério Vicente 61 Jun 23, 2022
PHP cache implementation supporting memcached

php cache implementation (PSR-6 and PSR-16) Support for memcached and APCu is included. Memcached $memcached = new Memcached(); $memcached->addServer(

Michael Bretterklieber 1 Aug 11, 2022
The cache component provides a Promise-based CacheInterface and an in-memory ArrayCache implementation of that

Cache Async, Promise-based cache interface for ReactPHP. The cache component provides a Promise-based CacheInterface and an in-memory ArrayCache imple

ReactPHP 330 Dec 6, 2022
A fast, lock-free, shared memory user data cache for PHP

Yac is a shared and lockless memory user data cache for PHP.

Xinchen Hui 815 Dec 18, 2022
More Than Just a Cache: Redis Data Structures

More Than Just a Cache: Redis Data Structures Redis is a popular key-value store, commonly used as a cache or message broker service. However, it can

Andy Snell 2 Oct 16, 2021
Refresh items in your cache without data races.

Cache Refresh Refresh items in your cache without data races. use Illuminate\Support\Facades\Cache; use Illuminate\Support\Collection; use App\Models\

Laragear 3 Jul 24, 2022