Skip to content

Instantly share code, notes, and snippets.

View kolyadin's full-sized avatar

Aleksey kolyadin

  • Easy Commerce
View GitHub Profile
public function findByHash($userId,$securityHash){
$this->findByHashMemoryStatement->bindValue(':id',$userId);
$this->findByHashMemoryStatement->bindValue(':securityHash',$securityHash);
$this->findByHashMemoryStatement->execute();
$userIdMemory = $this->findByHashMemoryStatement->fetch(\PDO::FETCH_COLUMN);
if ($userIdMemory){
//Сначала проверяем существует ли hash пользователя в кэше (mysql memory)
public static function incrementViews($newsId){
self::checkDataMap();
/** @var $post \popcorn\model\posts\NewsPost */
$post = self::$dataMap->findById($newsId);
$post->setViews($post->getViews()+1);
self::$dataMap->save($post);
}
return $cache->set($cacheKey,'20s',array('manufacture','bike_model'))->call(function() use($mysqli,$resizer) {
$result = $mysqli->queryFile('/bank.sql/moto-front');
$bikes = array();
while ($row = $result->fetch_assoc())
{
$row['pic'] = $resizer->resize($row['pic'],'{"h":120}');
$bikes[] = $row;
}
<?php
class KaCache
{
private $memObject,$name,$lifetime;
private $tags = array();
private $app;
public function __construct(Ka $app)