Download the PHP package mouf/utils.cache.cache-interface without Composer
On this page you can find all versions of the php package mouf/utils.cache.cache-interface. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mouf/utils.cache.cache-interface
More information about mouf/utils.cache.cache-interface
Files in mouf/utils.cache.cache-interface
Package utils.cache.cache-interface
Short Description This package only contains the interface that must be implemented by caching classes. Unless you want to implement your own caching method, you should import a cache package that will use this interface. For instance, common.utils.session-cache, or common.utils.file-cache.
License MIT
Homepage https://github.com/thecodingmachine/utils.cache.cache-interface
Informations about the package utils.cache.cache-interface
Mouf Cache system
The Mouf framework is only an IOC framework. As such, it does not provide any means for managing any kind of cache. Hopefully, the Mouf team provides also a range of packages to manage the caching of objects.
The cache architecture
Mouf provides several implementations of caching, and you can provide your own if you want.
Each cache mechanism must just extend the CacheInterface
interface that is part of the
package utils/cache/cacheinterface.
By default, Mouf provides these caches:
- FileCache: a cache that writes cached elements in files, in a temporary folder.
- SessionCache: a cache that writes cached elements in the session of the current user. Therefore, this cache is local to a user.
- ApcCache: a cache that uses the APC extension to store data.
- NoCache: a cache that... does not provide any cache. Can be useful for development purpose.
The cache methods
Each class implementing the CacheInterface provides simple methods to get and set data in the cache:
For instance, to store some value in the cache, you just need to write:
This will store the value "myvalue" in the cache, with key "mykey". The value will be stored for 15 seconds. If within 15 seconds, we perform a call to retrieve the cache, the value will be retrieved:
The third parameter is optional. If not passed, the default value will be used. The default value is "forever", which means the cached value will never time out. The default value can be overidden in the Mouf cache instance properties.
All versions of utils.cache.cache-interface with dependencies
mouf/utils.composite-exception Version ^1
mouf/utils.cache.purge-ui Version ^1