Loading repository data…
Loading repository data…
TruCopilot / repository
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.
As the V9 is relatively not compatible with previous versions, please read carefully the migration guide to ensure you the smoothest migration possible. One of the biggest changes is the configuration system which is now an object that replace the primitive array that we used to implement back then. Also, please note that the V9 requires at least PHP 8 or higher to works properly.
More information in Wiki The simplicity of abstraction: One class for many backend cache. You don't need to rewrite your code many times again.
:bulb: Feel free to propose a driver by making a new Pull Request, they are welcome !
| Regular drivers | High performances drivers | Development drivers (Core) | Cluster-Aggregated drivers (Core) |
|---|---|---|---|
Apcu (Core) (APC support removed) | Arangodb (Extension) | Devnull | FullReplicationCluster |
Dynamodb (Extension) | Cassandra (PHP extension is no more maintained by Datastax, might be deprecated in v10) | Devrandom | SemiReplicationCluster |
Files (Core) | CouchBasev3 (Core)(Will be deprecated as of v10) | Memory(Previously named Memstatic) | MasterSlaveReplicationCluster |
Firestore (Extension) | CouchBasev4 (Extension) | RandomReplicationCluster | |
Leveldb (Core) | Couchdb (Extension) | ||
Memcache(d) (Core) | Mongodb (Extension) | ||
Solr (Extension) | Predis (Core) | ||
Sqlite (Core) | _() |
* Driver descriptions available in DOCS/DRIVERS.md
:new: As of v9.2 a new Couchbase extension has been released: Couchbasev4
Also a new driver extension has been added: Ravendb. The driver will be actively developed in the feature to allow better fine-grained configuration.
This new extension is the beginning of a new era for Phpfastcache along with some others:
Many drivers has been moved from the core to their own sub-repository as a standalone extension: Arangodb, Couchdb, Dynamodb, Firestore, Mongodb, Solr.
They can be easily added through composer, ex: composer install phpfastcache/couchbasev4-extension
However Couchbasev3 will stay in the core for compatibility reasons but will be deprecated.
Phpfastcache has been developed over the years with 3 main goals:
Phpfastcache provides you a lot of useful APIs:
| Method | Return | Description |
|---|---|---|
addTag($tagName) | ExtendedCacheItemInterface | Adds a tag |
addTags(array $tagNames) | ExtendedCacheItemInterface | Adds multiple tags |
append($data) | ExtendedCacheItemInterface | Appends data to a string or an array (push) |
decrement($step = 1) | ExtendedCacheItemInterface | Redundant joke... |
expiresAfter($ttl) | ExtendedCacheItemInterface | Allows you to extends the lifetime of an entry without altering its value (formerly known as touch()) |
expiresAt($expiration) | ExtendedCacheItemInterface | Sets the expiration time for this cache item (as a DateTimeInterface object) |
get() | mixed | The getter, obviously, returns your cache object |
getCreationDate() | \DatetimeInterface | Gets the creation date for this cache item (as a DateTimeInterface object) * |
getDataAsJsonString() | string | Return the data as a well-formatted json string |
getEncodedKey() | string | Returns the final and internal item identifier (key), generally used for debug purposes |
getExpirationDate() | ExtendedCacheItemInterface | Gets the expiration date as a Datetime object |
getKey() | string | Returns the item identifier (key) |
getLength() | int | Gets the data length if the data is a string, array, or objects that implement \Countable interface. |
getModificationDate() | \DatetimeInterface | Gets the modification date for this cache item (as a DateTimeInterface object) * |
getTags() |
Ravendb Wincache (Core) (Deprecated as of v9.2, will be removed as of v10) | Relay (By end of 2024) |
Zend Disk Cache (Core) | Redis/RedisCluster (Core) |
Ssdb (Core) |
Zend Memory Cache (Core) |
string[] |
| Gets the tags |
hasTag(string $tagName) | bool | Check if the cache item |