The place to keep your cache.

Related tags

Caching Stash
Overview

Stash - A PHP Caching Library Build Status

License Latest Stable Version Coverage Status Total Downloads

Stash makes it easy to speed up your code by caching the results of expensive functions or code. Certain actions, like database queries or calls to external APIs, take a lot of time to run but tend to have the same results over short periods of time. This makes it much more efficient to store the results and call them back up later.

Installing

Installing Stash can be done through a variety of methods, although Composer is recommended.

Composer

Until Stash reaches a stable API with version 1.0 it is recommended that you review changes before Minor updates, although bug fixes will always be backwards compatible.

"require": {
  "tedivm/stash": "0.14.*"
}

or by using the composer require command:

composer require tedivm/stash

Github

Releases of Stash are available on Github.

Documentation

Although this README contains some useful data there is a lot more information at the main site, stashphp.com.

Core Concepts

Main Classes

Stash has three main components: a Pool class that represents a specific grouping of cached objects, an Item class that provides access to individual objects, and a series of Driver classes that allow Stash to interact with caching systems.

Each Driver is initialized and then passed into a Pool, at which point the developer can simply forget about it. Developers also have the option of using multiple Drivers together by joining them with the Composite Driver.

The Pool class allows developers to perform a number of tasks. There are a few maintenance related tasks, such as running a "Purge" to allow backend systems to perform maintenance tasks or set new logging or driver classes. The Pool also can be used to create Item objects, singly or in groups.

Each Item represents a single object inside the cache. It has a unique Key, meaning that any two Items created from the same Pool will contain the same Value. An Item can set, get and remove a value from a caching system.

Keys

A Key is a string that represents an Item in a caching system. At its simplest, a key is an alphanumeric string and has a one to one relationship with a value in the cache.

Stash provides a feature known as "stacks" that allows developers to group related Items together so they can be erased as a group. This is done by giving Items a nested structure, similar to folders on a computer. Just like with folders, this is represented by adding slashes to the name representing the file or cached object.

For example, a Key like "/models/users/34/profile" can allow developers to clear the data for specific users using that user's id, or clear the data for all users or even all models. It can also allow that developer to break up data into specific pieces to only load what is needed.

Session Storage

The provided Session class takes a Pool in its constructor and can then be registered as a Session Handler using the built-in PHP methods, the Session::registerHandler static function, or by using any framework that uses the SessionHandlerInterface interface.

Drivers

Stash currently supports the following backends:

  • FileSystem
  • Sqlite
  • APC
  • Memcached
  • Redis
  • Ephemeral (runtime only)

Stash also supports a specialized "Composite" Driver which can contain any number of the above drivers. This allows developers to created multi-tiered drivers that use a variety of back ends.

Symfony Integration

The Stash Bundle makes using Stash inside of Symfony projects significantly easier. This bundle exposes Stash as a Service for developers to use, and allows Symfony to use Stash as a session handler.

License

Stash is licensed under the BSD License. See the LICENSE file for details.

Reporting Security and Vulnerability Issues

This project utilizes the Tidelift Security Reporting System for security and vulnerability reporting.

Support

Issues can be opened directly in Github for issues that aren't related to security.

Professionally supported Stash is now available with Tidelift.

Comments
  • Use apcu_* functions instead of apc_* functions if available

    Use apcu_* functions instead of apc_* functions if available

    This still rely on APC backward compatibility of APCu where all apc_* functions internally call apcu_* functions. APC backward compatibility is included by default for APCu on PHP5.5 and PHP5.6. But for PHP7, APC backward compatibility is not included by default (and still not working on Windows). Any chance to update the APC driver to check for existence of apcu_fetch function and if so use the apcu_* functions with fallback to apc_* functions? Similar to https://github.com/illuminate/cache/blob/master/ApcWrapper.php

    See https://github.com/tedious/Stash/pull/256

    opened by layanto 21
  • Proposing Feature Dependencies

    Proposing Feature Dependencies

    The main purpose for this feature is to be able to invalidate cache entries and automatically invalidate other cache entries that are dependent from each other. Generally "Grouping" and "Namespacing" are good ideas but not suitable for the most use cases.

    Problem

    Let´t take the example of a simple one-to-one relation. We have a Brand and a Product. Both are models in some relational database. On the website we want to build a product presentation that looks like this

    $view = sprintf("%s by %s", $product, $brand);
    

    Now if we want to cache the view, currently neither namespacing nor grouping could help us invalidate the view, if it was cached and either product or brand changed.

    a general approach to cache all the items would be

    cache($product, "models/product/1")
    cache($brand, "models/brand/1")
    cache($view, "view/1");
    

    if than a $product or $brand changes, both need to now exactly who used them, to be able to invalidate also $view as it would otherwise display invalid out-dated data.

    Solution

    I will call my solution Dependency Inheritance and Cache Invalidation. Basically the Stash\Interfaces\ItemInterface gets one new method addDependency

    /**
     * Adds an ItemInterface as dependency. If the added
     * item gets invalidated, the caller also gets invalidated.
     * If $inherit is true, hierarchical dependencies are enabled.
     *
     * @param ItemInterface $dependency
     * @param boolean $inherit if dependencies should be inherited
     * @return boolean
     */
    public function addDependency(ItemInterface $dependency, $inherit = true);
    

    A dependency is nothing more than an instance of Stash\Interfaces\ItemInterface. Therefore it is able to hierarchically depend on many different items. This enables us to invalidate one deeply nested cache item. This would also invalidate the root element, but not all untouched siblings. So that the root has to refetch only really missing cache items and the rest can be used from already cached items.

    Under the hood my solution uses the same technique as the grouping mechanism. It takes a cache key and combines it with the dependent in the following way

    $key = array_merge([$dependency->key, $this->key])
    // ==> model/foo/1/model/bar/2
    

    This key is saved with a value of 1 the same way the stampede protection is saved. Then the new dependency $key is added to a list of dependencies into the items record array.

    The next time, when a cache item is fetched, the validation process also gets the dependency keys, fetches them using a multiGet and checks if the response count is the same as the count of the dependency keys. If any model that was saved and invalidated, everything in its group (Model/Product/ID/*) gets also deleted. This way not all dependency keys would be fetched and the count would mismatch. Bingo, we invalidated everything that depends on that item.

    So the example from above would look like this

    Cache Key : Model/Product/1
    Attributes: {
                    "name": "My Product"
                }
    
    Cache Key : Model/Brand/1
    Attributes: {
                    "name": "Great Company"
                }
    
    Cache Key : View/ProductPresentation/1
    Attrbiutes: {
                    "text": render(sprintf("%s by %s", cache("Model/Product/1"), cache("Model/Brand/1")))
                }
    Dependency: [
                    "Model/Product/1/View/ProductPresentation/1",
                    "Model/Brand/1/View/ProductPresentation/1"
                ]
    
    opened by theluk 18
  • Check whether opcache is restricted before attempting to invalidate

    Check whether opcache is restricted before attempting to invalidate

    This resolves issue #350

    When using the FileSystem driver on a system where opcache.restrict_api is defined in php.ini, stash throws a fatal error on save. With this change, we check that ini setting before attempting to clear cache.

    Type: Bug Priority: High 
    opened by KorvinSzanto 18
  • Opcache is a problem with the FileSystem driver

    Opcache is a problem with the FileSystem driver

    This is a bit of a long story.

    I've been working with tedivm/Stash for a while for an Authentication and Authorisation library. I was using the FileSystem driver for file based sessions. It was working for a long time, both from a Windows computer and on hosted Ubuntu system on Digital Ocean.

    However I recently started testing it on my Ubuntu VM which runs on the same kind of specs as the Digital Ocean's VM in order to simulate a closer environment to production.

    And then the session management broke.

    I started logging everything to figure out what was happening. And what was happening was this, but let me describe the context first.

    <?php 
    /* Cachekey: cache/polyauthqkc1z5m33e/ */
    /* Type: array */
    $expiration = 1394941347;
    $data = array();
    
    /* Child Type: array */
    $data['return'] = unserialize(base64_decode('YToxOntzOjc6InVzZXJfaWQiO2I6MDt9'));
    
    /* Child Type: integer */
    $data['createdOn'] = 1394901250;
    

    Here is the included file (cached file). The returned variable should end up being: ["user_id" => false];

    I know this is the real file content prior the the include command because I wrote this as a part of my logger:

    //...line 141
    \FB::log(file_get_contents($path), 'FILE CONTENT PRIOR TO INCLUSION');
    
    include($path);
    //...etc
    

    And it showed the above file content exactly prior to inclusion.

    Now the next thing I did was log the $data variable.

    //...line 141
    \FB::log(file_get_contents($path), 'FILE CONTENT PRIOR TO INCLUSION');
    
    include($path);
    
    \FB::log($data, 'DATA VARIABLE');
    //...etc
    

    This is where the discrepancy appeared.

    On my Windows (Apache + mod_php) system it showed:

           "data"       => [
               "return"    => [
                   "user_id" => false
               ],
               "createdOn" => 1394901250
           ]
    

    On my Ubuntu Digital Ocean VM it would show the same since the session management was working.

    However on my Ubuntu VirualBox VM it would show:

           "data"       => [
               "return"    => [],
               "createdOn" => 1394901250
           ]
    

    Exactly the same createdOn timestamp, but an empty return array!?

    Needless to say, this made session management impossible, since none of the sessions could ever be remembered.

    Now the error goes away, and still works with all environments, if you instead use eval with file_get_contents:

    eval('?>' . file_get_contents($path));
    

    This technique is exactly equivalent to using include (the ?> basically allows the file to start with <?php). See this: http://stackoverflow.com/questions/1184628/php-equivalent-of-include-using-eval

    I don't know why this error occurs. I don't have enough knowledge about the PHP internals why include doesn't work but this does. It might have something to do with opcode or caching.

    I also did some benchmarking. Zero microtime difference.

    opened by CMCDragonkai 18
  • Apc Driver: Check for 'apc.enable_cli' in cli calls

    Apc Driver: Check for 'apc.enable_cli' in cli calls

    As described in #365, Stash can currently run into a fatal error in specific circumstances.

    This PR introduces a check in Apc->isAvailable() to let the driver fail early if APCu is not configured to run in CLI environments.

    opened by Biont 16
  • Globally disable cache

    Globally disable cache

    I am looking for a way to globally disable cache for a pool, for use during development.

    I was hoping something like $pool->disable() would exist, which would then simply force isMiss() to return true, so that the operation happens always.

    This would mean that regardless of the timeout time, it would be ignored.

    opened by alexbowers-tecmark 16
  • Unable to create file on windows

    Unable to create file on windows

    Stash v0.10.1 on windows fails with the following error.

    Message: touch() [function.touch]: Unable to create file C:\wamp\www\clickfortime.com\httpdocs/application//cache/1952a01898073d1e/561b9b4f2e42cbd7/a8b72798beb911ae/98c8c8907d45950a/b2eb734903575495/3b57a32e2841bda5/dc960c46c38bd16e/953d97cdeefdbc68/e9772a20f09b5d13/28a579892c11a4c8/cfcd208495d565ef/66e7dff9f98764da.php because Invalid argument

    My best guess is because it is not using the correct path directory separator.

    opened by pwhelan 15
  • Rework In-Memory Storage

    Rework In-Memory Storage

    Currently Stash can't easily support multiple distinct cache spaces due to the potential for a collision in the memory handler. In order to improve this, the static in-memory handler should be replaced with an optional use of the Array handler stacked upfront in the Multihandler.

    opened by jhallbachner 15
  • Locking of cache item per key

    Locking of cache item per key

    I have a situation where there may be race conditions in the cache. That is when multiple requests are sent to the server, each one may manipulate the cache at the same time. Is there way to lock the cache item per process and make them evaluate one at a time after the previous lock opens?

    opened by CMCDragonkai 13
  • Memcached persistent connection.

    Memcached persistent connection.

    Memcache (without "d") connections are persistent by defautl. In order to save resources (new TCP/IP sockets for each HTTP requests) for both backends I propose to make Memcached connections to be persistent by default. To keep configuration easy and clean persist_id is calculated automatically based on servers list and options array (any change to options will cause persist_id change). #313 Can be resolved by this pull request.

    opened by mateusz-kolecki 12
  • Reduce function calls in creation of Item classes

    Reduce function calls in creation of Item classes

    With heavy use of Stash creation of Item classes & setKey shows up in profile data, so the change tries to reduce function calls in these.

    Suggested followup is executeGet(). Note: Might need another pass on this tomorrow for CS / tests if this is otherwise accepted. Note2: Contains interface change on Item to force array type on $key, felt like a easy way to avoid having to check.

    opened by andrerom 12
  • Fix #416 Session class incompatibility with PHP 7.x/8+

    Fix #416 Session class incompatibility with PHP 7.x/8+

    Due to difference in SessionInterfaceHandler interface in PHP 7.x and PHP 8+ gc method return type was ommited and suppressed warning as PHP 8+ It's better for future to make different version of Stash for PHP 7.x and PHP 8+

    Minor change was made also to remove cmpatibility with PHP version before 5.4.0 while Stash package is compatible with 7+.

    opened by mitkola 0
  • Union type declaration in Session.php is  available as of PHP 8.0.0

    Union type declaration in Session.php is available as of PHP 8.0.0

    Stash cache from version 0.17.0+ and later require PHP 7+, but there are union type declaration which is available as of PHP 8.0.0. This lead to syntax error in PHP 7+ environments!

    https://github.com/tedious/Stash/blob/a2c9df16c77b13e1f90462f30597a772166eea8f/src/Stash/Session.php#L229

    I suggest to use mixed return type and update PHP doc header.

    opened by mitkola 1
  • Cached instances of objects can be altered outside of Stash

    Cached instances of objects can be altered outside of Stash

    I'm getting "Serialization of Closure is not allowed" in concrete5 which uses Stash. This happens because objects stored in or returned by Empheral are a reference and any changes to the original/returned item also alters the stored instance in cache. Therefore requesting the same cached item twice might result in different returned values even though the key has not been altered through a regular Stash set function.

    This might be intended behaviour, although I don't feel it is really intuitive. It was suggested in the issue (concrete5/concrete5#6113) that this could be something that can be changed in Stash as well.

    footnote: concrete5 clones objects before caching in Stash, but retrieves the cached instance without cloning. So the problem is less apparent there.

    opened by Ruud-Zuiderlicht 3
  • lock method creates empty folder

    lock method creates empty folder

    If i use the lock method, the cache system creates an empty folder. Is that normal? This is my setup:

    $objCacheDriver = new \Stash\Driver\FileSystem(
    [
    	'path' => $this->objConfig->get('cache.file.path')
    ]);
    
    $objCache = new \Stash\Pool($objCacheDriver);
    
    $objCacheItem = $objCache->getItem('product.1233.444.555');
    
    $mixCacheData = $objCacheItem->get();
    
    if ($objCacheItem->isMiss())
    {
    	$objCacheItem->lock();
    
    	$mixCacheData = 1337;
    
    	$objCacheItem->set($mixCacheData);
    
    	$objCache->save($objCacheItem);
    }
    
    opened by benjaminfunk 0
  • Stash Issue with Concrete5?

    Stash Issue with Concrete5?

    We use Concrete5 to build sites and it uses Stash. I've got an issue on a site where we have large strings in the cache file and I get errors like: "PHP Warning: Unterminated comment starting line 16 in /home/www4x90/public_html/application/files/cache/0fea6a13c52b4d47/25368f24b045ca84/38a865804f8fdcb6/57cd99682e939275/18e23c785c6a72cf/ca47fbe20fed45aa.php on line 16"

    There is not an unterminated comment, the code is fine. I think the issue is that maybe the stash parser is not reading the entire file?

    I've attached a problem php cache file. Is the file too long to be passed? Is there a fix? ca47fbe20fed45aa.txt

    opened by madesimplemedia 4
Releases(v0.17.6)
  • v0.17.6(Jul 26, 2022)

    What's Changed

    • Fix deprecation error in memcache driver on php 8.1 by @brutto in https://github.com/tedious/Stash/pull/415

    Full Changelog: https://github.com/tedious/Stash/compare/v0.17.5...v0.17.6

    Source code(tar.gz)
    Source code(zip)
  • v0.17.5(May 31, 2022)

    What's Changed

    • implemented Item::extend(), fixed some PHPDoc inconsistencies by @iclukas in https://github.com/tedious/Stash/pull/414

    Full Changelog: https://github.com/tedious/Stash/compare/v0.17.4...v0.17.5

    Source code(tar.gz)
    Source code(zip)
  • v0.17.4(May 28, 2022)

    What's Changed

    • Add 'username' auth option to Redis driver by @okiedork in https://github.com/tedious/Stash/pull/413

    New Contributors

    • @okiedork made their first contribution in https://github.com/tedious/Stash/pull/413

    Full Changelog: https://github.com/tedious/Stash/compare/v0.17.3...v0.17.4

    Source code(tar.gz)
    Source code(zip)
  • v0.17.3(May 27, 2022)

    What's Changed

    • work around SQLite PDO’s inability to enforce permissions for data files by @iclukas in https://github.com/tedious/Stash/pull/411

    Full Changelog: https://github.com/tedious/Stash/compare/v0.17.2...v0.17.3

    Source code(tar.gz)
    Source code(zip)
  • v0.17.2(May 24, 2022)

    What's Changed

    • limit nesting loop for SQLite filename creation to count of key array… by @iclukas in https://github.com/tedious/Stash/pull/409

    Full Changelog: https://github.com/tedious/Stash/compare/v0.17.1...v0.17.2

    Source code(tar.gz)
    Source code(zip)
  • v0.17.1(Mar 21, 2022)

    What's Changed

    • Added an ability to set a default invalidation method for the pool by @Finesse in https://github.com/tedious/Stash/pull/407
    • Fix type hint on check filesystem permissions function by @tedivm in https://github.com/tedious/Stash/pull/408

    New Contributors

    • @Finesse made their first contribution in https://github.com/tedious/Stash/pull/407

    Full Changelog: https://github.com/tedious/Stash/compare/v0.17.0...v0.17.1

    Source code(tar.gz)
    Source code(zip)
  • v0.17.0(Mar 11, 2022)

    What's Changed

    • Mitigate T_ENCAPSED_AND_WHITESPACE bug by @iclukas in https://github.com/tedious/Stash/pull/399
    • Changed checkFileSystemPermissions arguments so PHP 8 won't throw Deprecated info by @mateuszdebinski in https://github.com/tedious/Stash/pull/404
    • Modernize PhpUnit by @tomkyle in https://github.com/tedious/Stash/pull/400
    • Filesystem Driver: Fix dir split not finishing cleanly by @the-eater in https://github.com/tedious/Stash/pull/405
    • update redis delete function by @tedivm in https://github.com/tedious/Stash/pull/393
    • Use Github Actions instead of Travis CI for testing by @tedivm in https://github.com/tedious/Stash/pull/406
    • phpdoc fix (Item::$invalidationMethod) by @DavidGoodwin in https://github.com/tedious/Stash/pull/396
    • Encoding Numeric Strings by @rodnaph in https://github.com/tedious/Stash/pull/384

    New Contributors

    • @mateuszdebinski made their first contribution in https://github.com/tedious/Stash/pull/404
    • @tomkyle made their first contribution in https://github.com/tedious/Stash/pull/400
    • @the-eater made their first contribution in https://github.com/tedious/Stash/pull/405
    • @DavidGoodwin made their first contribution in https://github.com/tedious/Stash/pull/396
    • @rodnaph made their first contribution in https://github.com/tedious/Stash/pull/384

    Full Changelog: https://github.com/tedious/Stash/compare/v0.16.0...v0.17.0

    Source code(tar.gz)
    Source code(zip)
  • v0.16.0(Jan 18, 2021)

    What's Changed

    • docs: add upgrade notes for 0.14 by @andheiberg in https://github.com/tedious/Stash/pull/387
    • docs: add upgrade docs for setting TTL in 0.14 by @andheiberg in https://github.com/tedious/Stash/pull/388

    New Contributors

    • @andheiberg made their first contribution in https://github.com/tedious/Stash/pull/387

    Full Changelog: https://github.com/tedious/Stash/compare/v0.15.2...v0.16.0

    Source code(tar.gz)
    Source code(zip)
  • v0.15.2(Mar 10, 2019)

  • v0.15.1(Sep 16, 2018)

    What's Changed

    • travis ci upgrades by @tedivm in https://github.com/tedious/Stash/pull/357
    • [Driver/Composite] Fix PHP 7.2 failure by @siwinski in https://github.com/tedious/Stash/pull/356
    • Apc Driver: Check for 'apc.enable_cli' in cli calls by @Biont in https://github.com/tedious/Stash/pull/368
    • Add option to limit number of items stored in ephemeral driver. by @mbaynton in https://github.com/tedious/Stash/pull/370
    • Fixing some phpdoc errors by @design1online in https://github.com/tedious/Stash/pull/371
    • Drop PHP5 and HHVM, add more PHP7 versions, upgrade development dependencies by @tedivm in https://github.com/tedious/Stash/pull/373
    • Fix fatal error with auto classloader when APC(U)Iterator class does … by @iclukas in https://github.com/tedious/Stash/pull/378

    New Contributors

    • @siwinski made their first contribution in https://github.com/tedious/Stash/pull/356
    • @Biont made their first contribution in https://github.com/tedious/Stash/pull/368
    • @mbaynton made their first contribution in https://github.com/tedious/Stash/pull/370
    • @design1online made their first contribution in https://github.com/tedious/Stash/pull/371

    Full Changelog: https://github.com/tedious/Stash/compare/v0.14.2...v0.15.1

    Source code(tar.gz)
    Source code(zip)
  • v0.14.2(May 30, 2017)

  • v0.14.1(Feb 10, 2016)

    v0.14.1

    • Implemented PSR-6 interfaces.
    • Removed Driver::setOptions($options) in favor of Driver::constructor($options)
    • Removed deprecated DriverList::getDrivers function.
    • Removed deprecated invalidation constants in the Item class.
    • Removed SQLite Extension support (SQLite3 is still available).
    • The set function no longer persists data.
    • Removed expiration time for set function
    • Added expiresAt and expiresAfter functions to the Item class.
    • getExpiration to return current datetime when no record exists.
    • Added save function to PoolInterface.
    • Changed getItemIterator to getItems
    • RuntimeException now extends from \RuntimeException
    • Added isHit function to ItemInterface.
    • Added the hasItem function to the Pool, which should mostly be avoided.
    • Renamed Pool::purge to Pool::clear.
    • Added Pool::deleteItem and Pool::deleteItems.
    • Removed legacy methods for defining keys- keys must be defined as strings.
    • Added support for "APCU" functions.
    • Removed sqlite2 support (sqlite3 is still supported).
    Source code(tar.gz)
    Source code(zip)
  • v0.13.2(Dec 29, 2015)

    v0.13.2

    • Fixed bug where the default filesystem driver path would be created even when a path was specified.
    • Updated development dependencies.
    • Required PHP7 tests to pass.
    Source code(tar.gz)
    Source code(zip)
  • v0.13.1(Aug 2, 2015)

    0.13.1

    • Dropped support for PHP 5.3.
    • Updated dependencies.
    • Removed various PHP warnings (exceptions are still thrown where needed).
    • Various optimizations, such as reduced function calls during repeated operations.
    • Added "isPersistent" method to driver classes.
    Source code(tar.gz)
    Source code(zip)
  • v0.12.3(Jan 17, 2015)

  • v0.12.2(Dec 8, 2014)

    This backwards compatible release contains a number of feature and stability improvements, particularly for users of HHVM, Memcache on AWS, or the Redis drivers.

    • Added an alternative format than native PHP for the Filesystem Driver using the "encoder" option.
    • Improved performance of Filesystem clear operations.
    • Better commenting on files generated by Filesystem driver.
    • Added work around for HHVM APCIterator bug.
    • Improved Redis error handling in the event of a lost or disconnected server.
    • Improved Redis and Memcached persistent connection support.
    • Added support for AWS autodiscovery functionality in Memcached.
    • Refactored PDO and SQLite "isAvailable" functions to prevent notices when the PDO extension is not present.
    • Docblock and commenting improvements.
    • Updated dependency versions (only affects development code).
    Source code(tar.gz)
    Source code(zip)
  • v0.12.1(Jun 5, 2014)

    This release is designed specifically to make integrating, extending and developing Stash easier. Although there have been some API additions, the bulk of the work is behind the scenes. That being said we've pushed in a few BC breaks that we've been meaning to make for awhile, so please review the changelog carefully (especially if you have custom drivers or specialized code for initializing them).

    Major Updates:

    • Full HHVM Support
    • Removed xcache experimental driver.
    • Removed PEAR Support
    • Internal Improvements- DocBlock, Explicitly Defined Variables, Commenting.
    • Enforcement of code standards in test suite.
    • FileSystem - Improved Storage and Retrieval
    • Memcache - Altered subdrivers constructors and initialization.
    • SQLite - Reduced duplicate code amongst PDO subdrivers.
    • Updated Test Suite to make it simple to run again custom Pool or Item objects other than the build in ones.
    • Redis and Memcache constructors now take both forms (associative array or indexed array) when setting server configuration. Originally Memcache accepted an indexed list of settings while Redis expected an associative array.

    API Changes:

    • Removed constructor requirements from DriverInterface and added setOptions to replace it. Please note this means all drivers no longer take their options through the constructor, but expect them through the setOptions method.
    • Replaced "Item->setDriver" with "Item->setPool" function. This should have no effect on typical consumers of this library but may effect those extending the Item or Pool class.
    • Renamed Drivers class to DriversList to prevent confusion when talking about "Drivers".
    • Added DriversList::getAllDrivers which returns an unfiltered list of registered drivers.
    • Added DriversList::getAvailableDrivers to replace the existing DriversList::getDrivers, which is now deprecated.
    • Added "setDriver(DriverInterface $driver)" and "setKey($key, $namespace = null)" functions to the Item Interface. These functions are used by Pool to initialize the Item class.
    • Added "setNamespace($namespace = null)" and "getNamespace()" functions to the Pool class for.
    • Added "getCreation()" and "getExpiration()" functions to the Item class.
    • Added internal function Utilities::checkFileSystemPermissions.
    • Moved Item::SP_* Constants to new Invalidation class and Deprecated the existing Item::SP_* constants.
    • "PRECOMPUTE" is now the default method for dealing with stale data.
    Source code(tar.gz)
    Source code(zip)
  • v0.11.6(Mar 30, 2014)

    This release deals with changes between the APC and Opcode Caching system in PHP 5.4, specifically how opcode caches get invalidated. As of this release the Filesystem Driver explicitly invalidates the opcode cache for the files it creates or updates, preventing PHP from including an older version of it's data.

    Source code(tar.gz)
    Source code(zip)
  • v0.11.5(Mar 6, 2014)

    This release takes care of a small bug that occurs when running on OSX. This bug was caused by improper checking of the operating system, which was causing a Windows work around designed to limit filename length to kick in when it wasn't needed.

    Source code(tar.gz)
    Source code(zip)
  • v0.11.4(Dec 20, 2013)

  • v0.11.3(Dec 19, 2013)

  • v0.11.2(Nov 30, 2013)

    This is the first bug release of the 0.11 line, so if you are updating from an older version please see the 0.11 notes.

    • Fixed Bug which prevented some file based caches from purging or flushing on Windows based systems.
    • Fixed Bug in the Filesystem cache which caused a fatal error when certain keys were used.
    Source code(tar.gz)
    Source code(zip)
  • v0.11.1(Nov 18, 2013)

    This represents the first backwards compatibility break since v0.10.1 about one year ago. These are detailed in the changelog, but for the most part will be minor tweaks for a small amount of users.

    One of the biggest additions is a new set of Interfaces. This will allow developers to type check for the interfaces, rather than the class type, which should in turn allow developers to create custom Pool or Item classes when needed. This should also make the future addition of PSR-5 support a bit easier.

    Another useful addition in this release is logging support. By using PSR-3 compliant logging libraries, such as monolog, developers can now get a much better look at what's going on inside of Stash and admins can see when errors are occurring with their underlying cache systems.

    Source code(tar.gz)
    Source code(zip)
Owner
Tedious Developments
Libraries That Prevent Boredom
Tedious Developments
This is a Symfony bundle that lets you you integrate your PSR-6 compliant cache service with the framework

PSR-6 Cache bundle This is a Symfony bundle that lets you you integrate your PSR-6 compliant cache service with the framework. It lets you cache your

null 43 Oct 7, 2021
Refresh items in your cache without data races.

Cache Refresh Refresh items in your cache without data races. use Illuminate\Support\Facades\Cache; use Illuminate\Support\Collection; use App\Models\

Laragear 3 Jul 24, 2022
Simple artisan command to debug your redis cache. Requires PHP 8.1 & Laravel 9

?? php artisan cache:debug Simple artisan command to debug your redis cache ?? Installation You can install the package via composer: composer require

Juan Pablo Barreto 19 Sep 18, 2022
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

Matthias Mullie 295 Nov 28, 2022
Cache slam defense using a semaphore to prevent dogpile effect.

metaphore PHP cache slam defense using a semaphore to prevent dogpile effect (aka clobbering updates, stampending herd or Slashdot effect). Problem: t

Przemek Sobstel 102 Sep 28, 2022
:zap: Simple Cache Abstraction Layer for PHP

⚡ Simple Cache Class This is a simple Cache Abstraction Layer for PHP >= 7.0 that provides a simple interaction with your cache-server. You can define

Lars Moelleken 27 Dec 8, 2022
Doctrine Cache component

Doctrine Cache Cache component extracted from the Doctrine Common project. Documentation This library is deprecated and will no longer receive bug fix

Doctrine 7.6k Jan 3, 2023
LRU Cache implementation in PHP

PHP LRU Cache implementation Intro WTF is a LRU Cache? LRU stands for Least Recently Used. It's a type of cache that usually has a fixed capacity and

Rogério Vicente 61 Jun 23, 2022
Simple cache abstraction layer implementing PSR-16

sabre/cache This repository is a simple abstraction layer for key-value caches. It implements PSR-16. If you need a super-simple way to support PSR-16

sabre.io 48 Sep 9, 2022
PSR-6 cache implementation adapting a given PSR-16 instance

PSR-6 cache implementation adapting PSR-16 This package provides a PSR-6 cache instance when you only have a PSR-16 cache at hand. As PSR-6 is more fe

null 1 Oct 15, 2021
More Than Just a Cache: Redis Data Structures

More Than Just a Cache: Redis Data Structures Redis is a popular key-value store, commonly used as a cache or message broker service. However, it can

Andy Snell 2 Oct 16, 2021
Simple cache

Simple cache

Róbert Kelčák 3 Dec 17, 2022
Elephant - a highly performant PHP Cache Driver for Kirby 3

?? Kirby3 PHP Cache-Driver Elephant - a highly performant PHP Cache Driver for Kirby 3 Commerical Usage Support open source! This plugin is free but i

Bruno Meilick 11 Apr 6, 2022
An improved helper for working with cache

Laravel Cache Installation To get the latest version of Laravel Cache, simply require the project using Composer: $ composer require dragon-code/larav

The Dragon Code 64 Sep 23, 2022
Zend Framework cache backend for MongoDB

Zend_Cache_Backend_Mongo Author: Anton Stöckl About Zend_Cache_Backend_Mongo is a Zend Framework Cache Backend for MongoDB. It supports tags and autoc

Anton Stöckl 12 Feb 19, 2020
PHP local cache

__ ____ _________ ______/ /_ ___ / __ \/ ___/ __ `/ ___/ __ \/ _ \ / /_/ / /__/ /_/ / /__/ / / / __/ / ._

Jayden Lie 48 Sep 9, 2022
A fast, lock-free, shared memory user data cache for PHP

Yac is a shared and lockless memory user data cache for PHP.

Xinchen Hui 815 Dec 18, 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