Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

valmat/Cacher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description page: http://www.valmat.ru/2010/10/php-cacher.html
Github: http://github.com/valmat/Cacher
License: GPL v.3  http://www.gnu.org/licenses/gpl.txt

Minimal version PHP: 5.2.1
In some cases (for some backend) need memcache


Comment language: Russian
========================================
	*	Motivation

Create simple and powerful caching module with clear logic. To work on a single server, but at the same time, the highloaded project. 
With the ability to change the strategy of cashing in on the current load level of the project.

	*	Architecture

The main logical units are:
    * Cacher - front to caching classes.
    * Cacher_Backend - actually own caching classes.
    * Slots - caching and access to the cache via the slots.
    * Tags - to simplify the management of cache, and mainly for recaching.
    * Types of caching - for transparent caching strategy changes. Ie specific caching backend, via the slot (or tag), which in turn operate types. 

	*	Using

class Cacher
Requires a class inherits an interface Cacher_Backend - a family of classes that implement the backend class Cacher 
All operations with the cache is carried out at a lower level through the backends.
Backend can be a file system, shared memory, memcache, Sqlite, and other cacheing system.


	*	Example:


$slot = Cacher::create('User',$User);

//Get data
if (false === ($CacheData = $slot->get())) { 
       $CacheData = GetFromAnyExternal();
       $slot->addTag(Cacher_Tag::create('SmplTag',  $User));
       $slot->addTag(Cacher_Tag::create('SmplTag1', $User));
       $slot->set($CacheData);
}
 ...
 ...
 If you then need to reset some a tag, you will need to do so: 
 Cacher_Tag::create('AnyTagData', $AnyTagDataObj)->clear() // Clear cache of tag

------------------
More details on the Russian: http://www.valmat.ru/2010/10/php-cacher.html

About

Simple and powerful Cacher for a high loaded single-server projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages