Winter Data Memcache: Memcached Client Module
Winter Data Memcache connects Winter Boot applications to Memcached servers. It supports both the memcached and memcache PHP extensions, each through its own template.
Install suvera/winter-modules as described in Installation, then enable the module in application.yml:
modules: - module: 'dev\winterframework\data\memcache\MemcacheModule' enabled: true configFile: memcache-config.ymlRequirements
Section titled “Requirements”One of the two PHP Memcache client extensions is required — see Installation:
Configuration (memcache-config.yml)
Section titled “Configuration (memcache-config.yml)”Define connections under memcache: (for the memcache extension) and/or memcached: (for the memcached extension). Each entry becomes a bean named after its name.
# Used with the memcache extension -> MemcacheTemplatememcache: - name: bean01 idleTimeout: 30 timeout: 0 retry_interval: 0 status: 0 servers: - host: 127.0.0.1 port: 11211 weight: 0
# Used with the memcached extension -> MemcachedTemplatememcached: - name: bean02 timeout: 0 idleTimeout: 30 retry_interval: 0 status: 0 servers: - host: 127.0.0.1 port: 11211 weight: 0Autowire each template by its bean name:
use dev\winterframework\data\memcache\mc\MemcacheTemplate;use dev\winterframework\data\memcache\mcd\MemcachedTemplate;use dev\winterframework\stereotype\Autowired;
#[Autowired("bean02")]private MemcachedTemplate $memcached;
#[Autowired("bean01")]private MemcacheTemplate $memcache;