Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

phpfastcache

> 数据库
Open source

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

2.4K stars0 likes2 views
WebsiteGitHub

About

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

:warning: Please note that the V9 is mostly a PHP 8 type aware update of Phpfastcache with some significant changes !

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.


Simple Yet Powerful PHP Caching Class

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.

Supported drivers at this day *

: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) Ravendb _(Extension)
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)

* 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.


Because caching does not mean weaken your code

Phpfastcache has been developed over the years with 3 main goals:

  • Performance: We optimized and still optimize the code to provide you the lightest library as possible
  • Security: Because caching strategies can sometimes comes with unwanted vulnerabilities, we do our best to provide you a sage & strong library as possible
  • Portability: No matter what operating system you're working on, we did our best to provide you the most cross-platform code as possible

Rich Development API

Phpfastcache provides you a lot of useful APIs:

Item API (ExtendedCacheItemInterface)

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() string[] Gets the tags
hasTag(string $tagName) bool Check if the cache item contain one specific tag
hasTags(array $tagNames, int $strategy): bool bool Check if the cache item contain one or more specific tag with optional strategy (default to TAG_STRATEGY_ONE)
isTagged(): bool bool Check if the cache item has at least one tag (v9.2)
getTagsAsString($separator = ', ') string Gets the data as a string separated by $separator
getTtl() int Gets the remaining Time To Live as an integer
increment($step = 1) ExtendedCacheItemInterface To allow us to count on an integer item
isEmpty()

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHParangodbcachecassandracouchbase

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库