Download the PHP package zfegg/psr11-symfony-cache without Composer
On this page you can find all versions of the php package zfegg/psr11-symfony-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package psr11-symfony-cache
PSR-11 Symfony Cache
Symfony Cache Component Factories for PSR-11.
Table of Contents
- Installation
- Usage
- Containers
- Pimple
- Laminas Service Manager
- Frameworks
- Mezzio
- Laminas
- Slim
- Configuration
- Minimal Configuration
- Example
- Full Configuration
- Example
- Adaptors
- APCu
- Array
- Chain
- Couchbase
- Filesystem
- Memcached
- PDO & Doctrine DBAL
- PHP Array
- PHP Files
- Proxy
- Redis
Installation
Usage
Additional info can be found in the documentation
Containers
Any PSR-11 container wil work. In order to do that you will need to add configuration
and register a new service that points to Zfegg\Psr11SymfonyCache\CacheFactory
Below are some specific container examples to get you started
Pimple Example
Laminas Service Manager
Frameworks
Any framework that use a PSR-11 should work fine. Below are some specific framework examples to get you started
Mezzio
You'll need to add configuration and register the services you'd like to use. There are number of ways to do that
but the recommended way is to create a new config file config/autoload/cache.global.php
Configuration
config/config.php
Add CacheServiceAbstractFactory
of ServiceManager
.
config/autoload/cache.global.php
Laminas
You'll need to add configuration and register the services you'd like to use. There are number of ways to do that
but the recommended way is to create a new config file config/autoload/cache.global.php
Configuration
config/autoload/cache.global.php
Slim
public/index.php
Configuration
Minimal Configuration
A minimal configuration would consist of at least defining one service and the "default" adaptor.
Minimal Example (using Zend Expressive for the example)
Using this setup you will be using the "default" file system with the "default" adaptor. In this example we will be using the local file adaptor as the default.
Full Configuration
Note: A "default" adaptor is required.
Full Example
Adaptors
Example configs for supported adaptors
APCu
This adapter is a high-performance, shared memory cache. It can significantly increase an application’s performance, as its cache contents are stored in shared memory, a component appreciably faster than many others, such as the filesystem.
Docs: APCu Cache Adapter
Array
Generally, this adapter is useful for testing purposes, as its contents are stored in memory and not persisted outside the running PHP process in any way. It can also be useful while warming up caches, due to the getValues() method
Docs: APCu Cache Adapter
Chain
This adapter allows combining any number of the other available cache adapters. Cache items are fetched from the first adapter containing them and cache items are saved to all the given adapters. This exposes a simple and efficient method for creating a layered cache.
Docs: Chain Cache Adapter
Couchbase
This adapter stores the values in-memory using one (or more) Couchbase server instances. Unlike the APCu adapter, and similarly to the Memcached adapter, it is not limited to the current server’s shared memory; you can store contents independent of your PHP environment. The ability to utilize a cluster of servers to provide redundancy and/or fail-over is also available.
Docs: Couchbase Cache Adapter
Filesystem
This adapter offers improved application performance for those who cannot install tools like APCu or Redis in their environment. It stores the cache item expiration and content as regular files in a collection of directories on a locally mounted filesystem.
Docs: Filesystem Cache Adapter
Memcached
This adapter stores the values in-memory using one (or more) Memcached server instances. Unlike the APCu adapter, and similarly to the Redis adapter, it is not limited to the current server’s shared memory; you can store contents independent of your PHP environment. The ability to utilize a cluster of servers to provide redundancy and/or fail-over is also available.
Docs: Memcached Cache Adapter
PDO and Doctrine DBAL
This adapter stores the cache items in an SQL database.
Docs: PDO & Doctrine DBAL Cache Adapter
PHP Array
This adapter is a high performance cache for static data (e.g. application configuration) that is optimized and preloaded into OPcache memory storage. It is suited for any data that is mostly read-only after warmup.
Docs: PHP Array Cache Adapter
PHP Files
Similarly to Filesystem Adapter, this cache implementation writes cache entries out to disk, but unlike the Filesystem cache adapter, the PHP Files cache adapter writes and reads back these cache files as native PHP code.
Docs: PHP Files Cache Adapter
Proxy
This adapter wraps a PSR-6 compliant cache item pool interface. It is used to integrate your application’s cache item pool implementation with the Symfony Cache Component by consuming any implementation of Psr\Cache\CacheItemPoolInterface.
It can also be used to prefix all keys automatically before storing items in the decorated pool, effectively allowing the creation of several namespaced pools out of a single one.
Docs: Proxy Cache Adapter
Redis
This adapter stores the values in-memory using one (or more) Redis server instances.
Unlike the APCu adapter, and similarly to the Memcached adapter, it is not limited to the current server’s shared memory; you can store contents independent of your PHP environment. The ability to utilize a cluster of servers to provide redundancy and/or fail-over is also available.
Docs: Redis Cache Adapter
These docs, including the code samples, are licensed under a Creative Commons BY-SA 3.0 license.