It's Feb 2012, and I just spent half a day tracing a weird and sporadic problem back to Memcached extension (vers 1.0.2), which would randomly return SYSTEM ERROR and fail to either get or put data into unix memcached. Made one single change from Memcached extension back to Memcache extension and problem instantly vanished.
A year or three ago, I had changed from Memcache to Memcached for some other reason.
Now I'm on a mission to transcend the Memcache/Memcached fiasco. I'm going to try APC's variable cache, and if that doesn't work better than just revert to using a key:value stash collection in Mongo.
Basically, the Memcache / Memcache driver fiasco, which has been going on apparently for years now, has ruined serious use of unix memcached on PHP...unless you're huge and can afford to create your own MemcacheX driver...
Memcached
- 導入
- インストール/設定
- 定義済み定数
- 有効期限
- コールバック
- セッションのサポート
- Memcached — Memcached クラス
- Memcached::add — アイテムを新しいキーで追加する
- Memcached::addByKey — 指定したサーバーにアイテムを新しいキーで追加する
- Memcached::addServer — サーバーをサーバープールに追加する
- Memcached::addServers — 複数のサーバーをサーバープールに追加する
- Memcached::append — データを既存のアイテムに追記する
- Memcached::appendByKey — 指定したサーバーでデータを既存のアイテムに追記する
- Memcached::cas — アイテムを比較して入れ替える
- Memcached::casByKey — 指定したサーバーでアイテムを比較して入れ替える
- Memcached::__construct — Memcached のインスタンスを作成する
- Memcached::decrement — 数値アイテムの値を減らす
- Memcached::decrementByKey — Decrement numeric item's value, stored on a specific server
- Memcached::delete — アイテムを削除する
- Memcached::deleteByKey — 指定したサーバーからアイテムを削除する
- Memcached::deleteMulti — Delete multiple items
- Memcached::deleteMultiByKey — Delete multiple items from a specific server
- Memcached::fetch — 次の結果を取得する
- Memcached::fetchAll — 残りのすべての結果を取得する
- Memcached::flush — キャッシュ内のすべてのアイテムを無効にする
- Memcached::get — アイテムを取得する
- Memcached::getAllKeys — Gets the keys stored on all the servers
- Memcached::getByKey — 指定したサーバーからアイテムを取得する
- Memcached::getDelayed — 複数のアイテムを要求する
- Memcached::getDelayedByKey — 指定したサーバーに複数のアイテムを要求する
- Memcached::getMulti — 複数のアイテムを取得する
- Memcached::getMultiByKey — 指定したサーバーから複数のアイテムを取得する
- Memcached::getOption — Memcached のオプションの値を取得する
- Memcached::getResultCode — 直近の操作の結果コードを返す
- Memcached::getResultMessage — 最後に実行した操作の結果を説明したメッセージを返す。
- Memcached::getServerByKey — キーとサーバーを関連付ける
- Memcached::getServerList — プール内のサーバーの一覧を取得する
- Memcached::getStats — サーバープールの統計情報を取得する
- Memcached::getVersion — サーバープールのバージョン情報を取得する
- Memcached::increment — 数値アイテムの値を増やす
- Memcached::incrementByKey — Increment numeric item's value, stored on a specific server
- Memcached::isPersistent — Check if a persitent connection to memcache is being used
- Memcached::isPristine — Check if the instance was recently created
- Memcached::prepend — 既存のアイテムの前にデータを付加する
- Memcached::prependByKey — 指定したサーバーで既存のアイテムの前にデータを付加する
- Memcached::quit — Close any open connections
- Memcached::replace — 既存のキーのアイテムを入れ替える
- Memcached::replaceByKey — 指定したサーバーで既存のキーのアイテムを入れ替える
- Memcached::resetServerList — Clears all servers from the server list
- Memcached::set — アイテムを格納する
- Memcached::setByKey — 指定したサーバーにアイテムを格納する
- Memcached::setMulti — 複数のアイテムを格納する
- Memcached::setMultiByKey — 指定したサーバーで複数のアイテムを格納する
- Memcached::setOption — Memcached のオプションの値を設定する
- Memcached::setOptions — Set Memcached options
- Memcached::setSaslAuthData — Set the credentials to use for authentication
- Memcached::touch — Set a new expiration on an item
- Memcached::touchByKey — Set a new expiration on an item on a specific server
- MemcachedException — MemcachedException クラス
mike at eastghost dot com ¶
1 year ago
joelhy ¶
2 years ago
For those confuse about the memcached extension and the memcache extension, the short story is that both of them are clients of memcached server, and the memcached extension offer more features than the memcache extension.
davidt ¶
4 months ago
The module also supports SASL authentication, it just isn't documented sadly. You'll need to run the following code:
<?php
$m = new Memcached();
$m->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$m->setSaslAuthData("user-1", "pass");
?>
You need to enable the "memcached.use_sasl = 1" ini option for memcached in the php.ini file.
