每天laravel-20160621|MeacachedStore
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了每天laravel-20160621|MeacachedStore相关的知识,希望对你有一定的参考价值。
namespace Illuminate\Cache; use Memcached; use Illuminate\Contracts\Cache\Store; // a namespace about the user class MemcachedStore extends TaggableStore implements Store {// a Store about Memcache Store /** * The Memcached instance. * The Memcached instance. * @var \Memcached */ protected $memcached; /** * A string that should be prepended to keys. * A string that should be prepended to keys. * @var string */ protected $prefix;// a string about the prefix. with connection about the /** * Create a new Memcached store. * Create a new Memcached store. * @param \Memcached $memcached * @param string $prefix * @return void */ public function __construct($memcached, $prefix = ‘‘) { $this->setPrefix($prefix); $this->memcached = $memcached; }// a supper big prefix /** * Retrieve an item from the cache by key. * Retrieve an item form the cache by key. * @param string|array $key * @return mixed */ public function get($key) { $value = $this->memcached->get($this->prefix.$key);// a way to get value if ($this->memcached->getResultCode() == 0) { return $value; }// if return value, }// get a method /** * Retrieve multiple items from the cache by key. * Retrieve multiple items from the cache by key. * * Items not found in the cache will have a null value. * Items not found in the cache will have a null value. * @param array $keys * @return array */ public function many(array $keys) { $prefixedKeys = array_map(function ($key) { return $this->prefix.$key; }, $keys);// you are master , $values = $this->memcached->getMulti($prefixedKeys, null, Memcached::GET_PRESERVE_ORDER); // more get if ($this->memcached->getResultCode() != 0) { return array_fill_keys($keys, null); }// get the result return array_combine($keys, $values); }// get a lot of keys
本文出自 “专注php” 博客,请务必保留此出处http://lijinghsan.blog.51cto.com/3357095/1758727
以上是关于每天laravel-20160621|MeacachedStore的主要内容,如果未能解决你的问题,请参考以下文章
SQL:如何每天选择多条记录,假设每天包含超过1个值,MySQL