Skip to content

Winter Data Memcache: Memcached Client Module

Winter Data Memcache is a module that provides easy configuration and access to Memcached service from Winter Boot applications. It supports both the memcached and memcache PHP extensions through dedicated templates.

Terminal window
composer require suvera/winter-modules

Append the following code to your application.yml:

modules:
- module: 'dev\winterframework\data\memcache\MemcacheModule'
enabled: true
configFile: memcache-config.yml

PHP has two very good libraries that can be used to work with Memcache:

  1. Memcached
  2. Memcache

One of these extensions is required.

Terminal window
pecl install memcached
pecl install memcache

This module provides the following services automatically available to you.

Available when the memcached PHP extension is installed.

Available when the memcache PHP extension is installed.

# When **memcache** php extension installed.
memcache:
- name: bean01
idleTimeout: 30
timeout: 0
retry_interval: 0
status: 0
servers:
- host: 127.0.0.1
port: 11211
weight: 0
# When **memcached** php extension installed.
memcached:
- name: bean02
timeout: 0
idleTimeout: 30
retry_interval: 0
status: 0
servers:
- host: 127.0.0.1
port: 11211
weight: 0
#[Autowired("bean02")]
private MemcachedTemplate $memcache1;
#[Autowired("bean01")]
private MemcacheTemplate $memcache2;