Cache data for a class/method

@param array   $identifier class|method|args
@param         $data       The data to store
@param integer $ttl        Seconds to expiration
@return $data
554945
public function set_method($identifier, $data, $ttl)
    {
        extract($identifier);

        $directory = $this->_prep_path($class, $method);

        // create a unique field name
        $filename = $this->_hash($args);

        // does a cache exist for this method? If so we leave the ttl
        if ($this->exists($filename, $directory)) {
            $ttl = null;
        }

        return $this->_write($filename, $data, $directory, $ttl);
    }
127830
public function retrieveById($identifier)
    {
        $user = $this->conn->table($this->table)->find($identifier);

        if (! is_null($user)) {
            return new GenericUser((array) $user);
        }
    }
14179
public function countOpenByIdentifier($identifier): int
    {
        $queryBuilder = $this->createQuery();
        $where = $queryBuilder->expr()->andX(
            $queryBuilder->expr()->eq('cache_url', $queryBuilder->createNamedParameter($identifier)),
            $queryBuilder->expr()->eq('call_date', $queryBuilder->createNamedParameter(0))
        );

        return (int)$queryBuilder->select('uid')
            ->from($this->getTableName())
            ->where($where)
            ->execute()
            ->rowCount();
    }
157803
public function save($id, $data, $ttl = 60, $raw = FALSE)
	{
		return wincache_ucache_set($id, $data, $ttl);
	}
293980
public function save($id, $data, $ttl = 60, $raw = FALSE)
	{
		return $this->{$this->_adapter}->save($this->key_prefix.$id, $data, $ttl, $raw);
	}
230200
public function getNodeByIdentifier($identifier)
    {
        $node = $this->firstLevelNodeCache->getByIdentifier($identifier);
        if ($node !== false) {
            return $node;
        }
        $nodeData = $this->nodeDataRepository->findOneByIdentifier($identifier, $this->getWorkspace(), $this->dimensions, $this->removedContentShown);
        if ($nodeData !== null) {
            $node = $this->nodeFactory->createFromNodeData($nodeData, $this);
        } else {
            $node = null;
        }
        $this->firstLevelNodeCache->setByIdentifier($identifier, $node);
        return $node;
    }
617037
public function set($name, $data, $ttl = 0)
    {
        return apc_store(
            $this->prefix . $this->normalizeName($name), 
            $data, 
            $ttl
        );
    }
101970
public function set($key, $data, $TTL)
    {
        if (empty($this->predis)) return false;

        $key = $this->processKey($key);

        $returnValue = $this->predis->set($key, serialize($data));

        if (!empty($TTL)) {
            $this->predis->expire($key, $TTL);
        }

        return $returnValue;
    }
335770
public function store($identifier, $data)
    {
        // Find the user id
        if (!is_numeric($identifier))
        {
            if(!$identifier = JUserHelper::getUserId($identifier)) {
                $identifier = 0;
            }
        }

        return parent::store($identifier, $data);
    }
813589
public function getClient($identifier)
    {
        $client = $this->getClientFromPool($identifier);

        if ($client === null) {
            $client = $this->createClient($identifier);
            $this->getSession()->registerClient($client);
        }

        return $client;
    }
952176
public function addIdentifier(string $identifier)
    {
        $count = $this->queueRepository->countOpenByIdentifier($identifier);
        if ($count > 0) {
            return;
        }

        $this->logger->debug('SFC Queue add', [$identifier]);

        $data = [
            'cache_url' => $identifier,
            'page_uid' => 0,
            'invalid_date' => \time(),
            'call_result' => '',
        ];

        $this->queueRepository->insert($data);
    }
348754
public function setClass($identifier, $class)
    {
        $identifier = (string) $identifier;

        if(parent::offsetExists($identifier))
        {
            $data = array(
                'identifier' =>  parent::offsetGet($identifier),
                'class'      =>  $class
            );

            apc_store($this->getNamespace().'-object_'.$identifier, $data);
        }

        return  parent::setClass($identifier, $class);
    }
746052
protected function cacheResponse(RequestInterface $request, Response $response, $ttl = null)
    {
        if (!$this->isSupportedMethod($request)) {
            return;
        }

        $cacheTtl = $ttl ?: $this->getCachettl($response);

        // do we have a valid ttl to set the cache ?
        if ($cacheTtl <= 0) {
            return;
        }

        if (($statusCode = $response->getStatusCode()) >= 500 && !$this->cacheServerErrors) {
            return;
        }

        if (($statusCode < 500 && $statusCode >= 400) && !$this->cacheClientErrors) {
            return;
        }

        // copy response in array to  store
        $cached = new \SplFixedArray(5);
        $cached[0] = $statusCode;
        $cached[1] = $response->getHeaders();
        $cached[2] = $response->getBody()->__toString();
        $cached[3] = $response->getProtocolVersion();
        $cached[4] = $response->getReasonPhrase();

        return $this->cache->set(
            self::getKey($request),
            serialize($cached),
            $cacheTtl
        );
    }
437165
public function store($identifier, $data)
    {
        if(!$data instanceof KUserInterface) {
            $data = $this->create($data);
        }

        $this->_users[$identifier] = $data;

        return $data;
    }
700192
public function make($identifier, $expireTime = 3600)
    {
        $json = [
            'TLS.account_type' => $this->accountType,
            'TLS.identifier' => (string)$identifier,
            'TLS.appid_at_3rd' => (string)$this->appId,
            'TLS.sdk_appid' => (string)$this->appId,
            'TLS.expire_after' => (string)$expireTime,
            'TLS.version' => '201512300000',
            'TLS.time' => (string)time()
        ];

        $content = $this->genSignatureContent($json);
        $signature = $this->makeSignature($content);
        $json['TLS.sig'] = base64_encode($signature);
        if ($json['TLS.sig'] === false) {
            throw new SignatureException('base64_encode error.');
        }
        $json_text = json_encode($json);
        if ($json_text === false) {
            throw new SignatureException('json_encode error.');
        }
        $compressed = gzcompress($json_text);
        if ($compressed === false) {
            throw new SignatureException('gzcompress error.');
        }
        return $this->base64Encode($compressed);

    }
1186882
public function getProxy(ClassMetadata $metadata, array $identifier) : GhostObjectInterface
    {
        $className                                 = $metadata->getClassName();
        $persister                                 = $this->cachedPersisters[$className]
            ?? $this->cachedPersisters[$className] = $this
                ->entityManager
                ->getUnitOfWork()
                ->getEntityPersister($metadata->getClassName());

        $proxyInstance                                            = $this
            ->proxyFactory
            ->createProxy(
                $metadata->getClassName(),
                $this->cachedInitializers[$className]
                    ?? $this->cachedInitializers[$className]      = $this->makeInitializer($metadata, $persister),
                $this->cachedSkippedProperties[$className]
                    ?? $this->cachedSkippedProperties[$className] = [
                        self::SKIPPED_PROPERTIES => $this->skippedFieldsFqns($metadata),
                    ]
            );

        $persister->setIdentifier($proxyInstance, $identifier);

        return $proxyInstance;
    }
685193
public static function getCached($identifier, $accessor) {
    if (!self::isCached($identifier, $accessor)) {
      return false;
    }

    return self::$cache[$identifier][$accessor];
  }