[READ-ONLY] Easy to use Caching library with support for multiple caching backends. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

Related tags

Caching cache
Overview

CakePHP Caching Library

The Cache library provides a Cache service locator for interfacing with multiple caching backends using a simple to use interface.

The caching backends supported are:

  • Files
  • APC
  • Memcached
  • Redis
  • Wincache
  • Xcache

Usage

Caching engines need to be configured with the Cache::config() method.

use Cake\Cache\Cache;

// Using a short name
Cache::config('default', [
    'className' => 'File',
    'duration' => '+1 hours',
    'path' => sys_get_tmp_dir(),
    'prefix' => 'my_app_'
]);

// Using a fully namespaced name.
Cache::config('long', [
    'className' => \Cake\Cache\Engine\ApcuEngine::class,
    'duration' => '+1 week',
    'prefix' => 'my_app_'
]);

// Using a constructed object.
$object = new FileEngine($config);
Cache::config('other', $object);

You can now read and write from the cache:

$data = Cache::remember('my_cache_key', function () {
	return Service::expensiveCall();
});

The code above will try to look for data stored in cache under the my_cache_key, if not found the callback will be executed and the returned data will be cached for future calls.

Documentation

Please make sure you check the official documentation

You might also like...
Simple Yet Powerful PHP Caching Class

The PHP high-performance object caching system ever. phpFastCache is a high-performance, distributed object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. phpFastCache dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful

Caching extension for the Intervention Image Class

Intervention Image Cache extends the Intervention Image Class package to be capable of image caching functionality.

DataLoaderPhp is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching.

DataLoaderPHP is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching.

The next-generation caching layer for PHP

The next-generation caching layer for PHP

Zend_Cache backend using Redis with full support for tags

This Zend_Cache backend allows you to use a Redis server as a central cache storage. Tags are fully supported without the use of TwoLevels cache so this backend is great for use on a single machine or in a cluster. Works with any Zend Framework project including all versions of Magento!

ReadMarvel's open sourced code

Read Marvel ReadMarvel.com is a fan made website. It is built entirely on Laravel 5. All data is provided by Marvel through their public Marvel API. Y

A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load.

A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.

CLI App and library to manage apc & opcache.

CacheTool - Manage cache in the CLI CacheTool allows you to work with APCu, OPcache, and the file status cache through the CLI. It will connect to a F

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

Owner
CakePHP
CakePHP
Stash makes it easy to speed up your code by caching the results of expensive functions or code

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

Tedious Developments 943 Dec 15, 2022
Remember your query results using only one method. Yes, only one.

Cache Query Remember your query results using only one method. Yes, only one. Articles::latest('published_at')->cache()->take(10)->get(); Keep this pa

Laragear 182 Dec 28, 2022
Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

laminas-cache Laminas\Cache provides a general cache system for PHP. The Laminas\Cache component is able to cache different patterns (class, object, o

Laminas Project 69 Jan 7, 2023
A simple cache library. Implements different adapters that you can use and change easily by a manager or similar.

Desarolla2 Cache A simple cache library, implementing the PSR-16 standard using immutable objects. Caching is typically used throughout an applicatito

Daniel González 129 Nov 20, 2022
A simple cache library. Implements different adapters that you can use and change easily by a manager or similar.

Desarolla2 Cache A simple cache library, implementing the PSR-16 standard using immutable objects. Caching is typically used throughout an applicatito

Daniel González 129 Nov 20, 2022
Yii Caching Library - Redis Handler

Yii Caching Library - Redis Handler This package provides the Redis handler and implements PSR-16 cache. Requirements PHP 7.4 or higher. Installation

Yii Software 4 Oct 9, 2022
Stash - A PHP Caching Library

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

Tedious Developments 943 Dec 15, 2022
Symfony Bundle for the Stash Caching Library

TedivmStashBundle The TedivmStashBundle integrates the Stash caching library into Symfony, providing a powerful abstraction for a range of caching eng

Tedious Developments 86 Aug 9, 2022
Query caching for Laravel

Query caching for Laravel

Dwight Watson 1k Dec 30, 2022