每天laravel-20160629|RedisTaggedCache
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了每天laravel-20160629|RedisTaggedCache相关的知识,希望对你有一定的参考价值。
<?php namespace Illuminate\Cache; // a namespace Cache class RedisTaggedCache extends TaggedCache {// a cache class about the Cache use in RedisTagged /** * Forever reference key. * * @var string */ const REFERENCE_KEY_FOREVER = ‘forever‘;// too long time to set the key values /** * Standard reference key. * * @var string */ const REFERENCE_KEY_STANDARD = ‘standard‘;// Standard reference key. /** * Store an item in the cache. * * @param string $key * @param mixed $value * @param \DateTime|int $minutes * @return void */ public function put($key, $value, $minutes = null) { $this->pushStandardKeys($this->tags->getNamespace(), $key); parent::put($key, $value, $minutes);// key values time[minutes] }// store a item into the redis cache. /** * Store an item in the cache indefinitely. * * @param string $key * @param mixed $value * @return void */ public function forever($key, $value) { $this->pushForeverKeys($this->tags->getNamespace(), $key); parent::forever($key, $value); }// Store an item in the cache in the cache indefinitely // use a parents function to set a long time ,so wo can wrapper is as forever /** * Remove all items from the cache. * * @return void */ public function flush() { $this->deleteForeverKeys(); $this->deleteStandardKeys(); parent::flush(); }// flush is a remove, remove all item from the cache. /** * Store standard key references into store. * * @param string $namespace * @param string $key * @return void */ protected function pushStandardKeys($namespace, $key) { $this->pushKeys($namespace, $key, self::REFERENCE_KEY_STANDARD); }//Store standard key references into store. /** * Store forever key references into store. * * @param string $namespace * @param string $key * @return void */ protected function pushForeverKeys($namespace, $key) { $this->pushKeys($namespace, $key, self::REFERENCE_KEY_FOREVER); }// Store forever key references into store. /** * Store a reference to the cache key against the reference key. * * @param string $namespace * @param string $key * @param string $reference * @return void */ protected function pushKeys($namespace, $key, $reference) { $fullKey = $this->getPrefix().sha1($namespace).‘:‘.$key;// set real key foreach (explode(‘|‘, $namespace) as $segment) { $this->store->connection()->lpush($this->referenceKey($segment, $reference), $fullKey); }// explode the string to array }// Store a reference to the cache key against the reference key. /** * Delete all of the items that were stored forever. * Delete all of the items that were stored forever. * @return void */ protected function deleteForeverKeys() { $this->deleteKeysByReference(self::REFERENCE_KEY_FOREVER); }// delete Key that be forever /** * Delete all standard items. * * @return void */ protected function deleteStandardKeys() { $this->deleteKeysByReference(self::REFERENCE_KEY_STANDARD); }// Delete all standard items. /** * Find and delete all of the items that were stored against a reference. * * @param string $reference * @return void */ protected function deleteKeysByReference($reference) { foreach (explode(‘|‘, $this->tags->getNamespace()) as $segment) { $this->deleteValues($segment = $this->referenceKey($segment, $reference)); $this->store->connection()->del($segment); } }// Find and delete all of the items that were stored against a reference. // this we find a way,the like to do some thing, // first set a cell function,then call it‘s. /** * Delete item keys that have been stored against a reference. * * @param string $referenceKey * @return void */ protected function deleteValues($referenceKey) { $values = array_unique($this->store->connection()->lrange($referenceKey, 0, -1)); if (count($values) > 0) { call_user_func_array([$this->store->connection(), ‘del‘], $values); } }// Delete item keys that have been stored against a reference. // /** * Get the reference key for the segment. * * @param string $segment * @param string $suffix * @return string */ protected function referenceKey($segment, $suffix) { return $this->getPrefix().$segment.‘:‘.$suffix; }// Get the reference key for the segment. }
本文出自 “专注php” 博客,请务必保留此出处http://lijinghsan.blog.51cto.com/3357095/1760310
以上是关于每天laravel-20160629|RedisTaggedCache的主要内容,如果未能解决你的问题,请参考以下文章
分发原始 msvcp.dll 或安装 vc_redist.exe
C# 检查已安装的 .NET Framework 和 MS Visual C++ Redist 版本