Server IP : 127.0.0.2 / Your IP : 3.144.112.72 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/ |
Upload File : |
<?php namespace Illuminate\Cache; class RedisTaggedCache extends TaggedCache { /** * Forever reference key. * * @var string */ const REFERENCE_KEY_FOREVER = 'forever_ref'; /** * Standard reference key. * * @var string */ const REFERENCE_KEY_STANDARD = 'standard_ref'; /** * Store an item in the cache. * * @param string $key * @param mixed $value * @param \DateTime|float|int $minutes * @return void */ public function put($key, $value, $minutes = null) { $this->pushStandardKeys($this->tags->getNamespace(), $key); parent::put($key, $value, $minutes); } /** * 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); } /** * Remove all items from the cache. * * @return void */ public function flush() { $this->deleteForeverKeys(); $this->deleteStandardKeys(); parent::flush(); } /** * 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 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 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->store->getPrefix().sha1($namespace).':'.$key; foreach (explode('|', $namespace) as $segment) { $this->store->connection()->sadd($this->referenceKey($segment, $reference), $fullKey); } } /** * Delete all of the items that were stored forever. * * @return void */ protected function deleteForeverKeys() { $this->deleteKeysByReference(self::REFERENCE_KEY_FOREVER); } /** * Delete all standard items. * * @return void */ protected function deleteStandardKeys() { $this->deleteKeysByReference(self::REFERENCE_KEY_STANDARD); } /** * 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); } } /** * 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()->smembers($referenceKey)); if (count($values) > 0) { foreach (array_chunk($values, 1000) as $valuesChunk) { call_user_func_array([$this->store->connection(), 'del'], $valuesChunk); } } } /** * Get the reference key for the segment. * * @param string $segment * @param string $suffix * @return string */ protected function referenceKey($segment, $suffix) { return $this->store->getPrefix().$segment.':'.$suffix; } }