Download the PHP package exos/hybridcache without Composer
On this page you can find all versions of the php package exos/hybridcache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download exos/hybridcache
More information about exos/hybridcache
Files in exos/hybridcache
Package hybridcache
Short Description PHP Cache manager with multiple storages types
License WTFPL
Homepage https://github.com/exos/HybridCache
Informations about the package hybridcache
Hybrid Cache for PHP >= 5.3.x
Example of usage:
Multiples storages
Currently, Hybrid Cache includes drivers for caching on Disk, Memcache and Redis, but you can extend it creating your own key/value storage connector, implementing the Hybrid\StorageMedia interface.
Storage instances can be assigned for reading and writing, and you can have multiple different storage systems.
Replication
Consider you have the following scenario using Redis:
You can set it up like this:
By default, HybridCache uses a hash-based mechanism to balance load on multiple storage media. In this case, each server will receive the same amount of petitions. In a replication scenario a random petition distribution is more effective and HybridCache can try using another server on the list if the first one doesn't return anything.
To change the balancing method you should change the balanceMethod property of the instance:
However, if you wish to apply the change globally for all new instances of the HybridCache class, you can define a constant:
Note that the random method is extremely inefficient when there are several master servers.
Horizontal scalability
Horizontal scalability can be achieved with any storage media and sometimes it's better than replication.
In this case you define a number of storage media and the balancing is done using a hash generated by the key-value pair. All backend use the same algorithm, so they will all fetch the cache on the corresponding storage medium. It is very important to define the storages in the same order in all the backend servers, since the algorithm is based on the order and amount of them.
By default HybridCache uses a hash balance method, but if you want to be sure, you can set it explicitly:
To define a scalation array:
Important: HybridCache doesn't support HA (High Availability) methods in this scenario yet. We expect to implement failover mechanisms on future versions.
Multiple array philosophy
In future versions we're planning to implement groups of arrays that can combine the efficency of scalability with the fault tolerance of replication.
Who use it??
DePaginas
Website with several sections, web directory, classifieds, news and more
Periodico Tribuna
Argentinan digital newspaper
http://periodicotribuna.com.ar/
uWall.tv
Best artist listed in a wall format. Just pick an artist and discover a new experience :)
Taggify
Ad network with improvents and creatives products.
README fixed by Andres Gattinoni
http://www.tail-f.com.ar/