Вход Регистрация
Файл: gapps/vendor/laravel/framework/src/Illuminate/Cache/TaggedCache.php
Строк: 64
<?php

namespace IlluminateCache;

use 
IlluminateContractsCacheStore;

class 
TaggedCache extends Repository
{
    use 
RetrievesMultipleKeys;

    
/**
     * The tag set instance.
     *
     * @var IlluminateCacheTagSet
     */
    
protected $tags;

    
/**
     * Create a new tagged cache instance.
     *
     * @param  IlluminateContractsCacheStore  $store
     * @param  IlluminateCacheTagSet  $tags
     * @return void
     */
    
public function __construct(Store $storeTagSet $tags)
    {
        
parent::__construct($store);

        
$this->tags $tags;
    }

    
/**
     * {@inheritdoc}
     */
    
protected function fireCacheEvent($event$payload)
    {
        
$payload[] = $this->tags->getNames();

        
parent::fireCacheEvent($event$payload);
    }

    
/**
     * Increment the value of an item in the cache.
     *
     * @param  string  $key
     * @param  mixed   $value
     * @return void
     */
    
public function increment($key$value 1)
    {
        
$this->store->increment($this->itemKey($key), $value);
    }

    
/**
     * Increment the value of an item in the cache.
     *
     * @param  string  $key
     * @param  mixed   $value
     * @return void
     */
    
public function decrement($key$value 1)
    {
        
$this->store->decrement($this->itemKey($key), $value);
    }

    
/**
     * Remove all items from the cache.
     *
     * @return void
     */
    
public function flush()
    {
        
$this->tags->reset();
    }

    
/**
     * {@inheritdoc}
     */
    
protected function itemKey($key)
    {
        return 
$this->taggedItemKey($key);
    }

    
/**
     * Get a fully qualified key for a tagged item.
     *
     * @param  string  $key
     * @return string
     */
    
public function taggedItemKey($key)
    {
        return 
sha1($this->tags->getNamespace()).':'.$key;
    }
}
Онлайн: 1
Реклама