本文整理汇总了PHP中Predis\Client::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::get方法的具体用法?PHP Client::get怎么用?PHP Client::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
/**
* {@inheritdoc}
*/
public function read($sessionId)
{
if ($dataSet = $this->client->get("wandu.http.sess.{$sessionId}")) {
return unserialize($dataSet);
}
return [];
}
示例2: checkIfUsernameExists
/**
* @param $username
*
* @return bool
*/
private function checkIfUsernameExists($username)
{
if ($this->redisClient->get("username:{$username}:id")) {
return true;
}
return false;
}
示例3: read
/**
* {@inheritdoc}
*/
public function read($sessionId)
{
if ($dataSet = $this->client->get("wandu.http.sess.{$sessionId}")) {
return $dataSet;
}
return '';
}
示例4: load
/**
* {@inheritdoc}
*/
public function load()
{
$contents = $this->client->get($this->key);
if ($contents) {
$this->setFromStorage($contents);
}
}
示例5: doFetch
/**
* {@inheritdoc}
*/
protected function doFetch($id)
{
$result = $this->client->get($id);
if (null === $result) {
return false;
}
return unserialize($result);
}
示例6: get
/**
* @param $key
* @return Password|null
*/
public function get($key)
{
$password = null;
if ($passwordData = $this->client->get($key)) {
$password = $this->getPasswordFromJson($passwordData);
}
return $password;
}
示例7: get
/**
* Get a variable
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function get($key, $default = null)
{
if ($this->client->exists($this->namespace . $key)) {
return $this->client->get($this->namespace . $key);
} else {
return $default;
}
}
示例8: fetch
/**
* {@inheritdoc}
*/
public function fetch($id)
{
$result = $this->client->get($this->prefix . $id);
if (null === $result) {
return false;
}
return $result;
}
示例9: read
/**
* @param string $sessionId
*
* @return string|null
*/
public function read($sessionId)
{
$key = $this->keyPrefix . $sessionId;
$startTime = microtime(true);
$result = $this->connection->get($key);
$this->newRelicApi->addCustomMetric(self::METRIC_SESSION_READ_TIME, microtime(true) - $startTime);
return $result ? json_decode($result, true) : '';
}
示例10: checkReadFromStorage
/**
* @return void
*/
private function checkReadFromStorage()
{
try {
$this->client->get(self::KEY_HEARTBEAT);
} catch (\Exception $e) {
$this->addDysfunction(self::HEALTH_MESSAGE_UNABLE_TO_READ_FROM_STORAGE);
$this->addDysfunction($e->getMessage());
}
}
示例11: find
/**
* @param $jobId
*
* @return AbstractJob
*/
public function find($jobId)
{
$data = $this->redis->get($this->namespace . $jobId);
$data = json_decode($data, true);
$jobClass = $data[AbstractJob::P_JOB_CLASS];
/** @var AbstractJob $job */
$job = new $jobClass($data);
return $job;
}
示例12: getUpdatedAt
/**
* {@inheritdoc}
*/
public function getUpdatedAt()
{
if ($this->client->exists('migraine:date')) {
$date = new \DateTime();
$date->setTimestamp(intval($this->client->get('migraine:date')));
return $date;
}
return null;
}
示例13: getItem
/**
* @param string $key
* @return \SplitIO\Component\Cache\Item
*/
public function getItem($key)
{
$item = new Item($key);
$redisItem = $this->client->get($key);
if ($redisItem !== null) {
$item->set($redisItem);
}
return $item;
}
示例14: isCached
/**
* {@inheritDoc}
*/
public function isCached($providerName, $query)
{
if (!$this->redis->exists($key = $this->getKey($providerName, $query))) {
return false;
}
$cached = new BatchGeocoded();
$cached->fromArray($this->deserialize($this->redis->get($key)));
return $cached;
}
示例15: indexAction
/**
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction(Request $request)
{
$certificationCounter = [];
foreach ($this->certificationManager->getCertifications() as $cn => $label) {
$certificationCounter[$cn] = ['metrics' => (int) $this->redisClient->get($cn), 'label' => $label, 'icon' => $this->certificationManager->getContext($cn)->getIcons()];
}
$response = $this->engine->renderResponse('@CertificationyWeb/Site/homepage.html.twig', ['count_members' => (int) $this->userRepository->countMembers(), 'certification_done' => (int) $this->redisClient->get('total'), 'certification_counters' => $certificationCounter]);
return $response;
}