sframe/memcache

memcache组件

dev-master 2014-12-04 13:50 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:29:02 UTC


README

基于php_memcache扩展的Memcache管理器 支持通过配置更轻松地支持多Memcache服务器

安装

composer require "sframe/memcache:dev-master"

配置

1 服务器

array(
    'host' => '',       // optional, default 127.0.0.1
    'port' => '',       // optional, default 11211
    'persistent' => false, // optional, default false
    'weight' => 1,      // optional, default 1
    'expire' => 86400,  // optional, default 86400 (1 day)
)

多服务器

array(
    'servers' => array(
        array(...),
        array(...),
        ...
    ),
    'expire' => 86400
)

demo.php

$mc = new \SFrame\Memcache\Memcache();
$mc->set('hello', 1);
$mc->get('hello');
$mc->delete('hello');