Hi all,
I want to cache my createBuilder result with mongo but i couldt get him. I dont know how can i solve it,
$frontCache = new Phalcon\Cache\Frontend\Base64(array(
"lifetime" => 172800
));
//Create a MongoDB cache
$cache = new Phalcon\Cache\Backend\Mongo($frontCache, array(
'server' => "mongodb://localhost",
'db' => 'popsbuy',
'collection' => 'products'
));
//ana sayfa ürünleri cacheleniyor
$cacheKey = 'products_main_page.cache';
$products = $cache->get($cacheKey);
if ($products === null) {
//popüler ürünler çekiliyor
$products = $this->modelsManager->createBuilder() ->columns(array('Product._like','comment_count','title','price_lower','price','image','AffiliateOffers.name','AffiliateOffers.seo_title','payout_yuzde','payout_nakit','payout_type','liked_users','xml_id','brand','model','AffiliateCompanies.tracking_id','Product.url','currency'))
->from('Product')
->join('AffiliateOffers','Product.aff_id = AffiliateOffers.af_id AND Product.offer_id = AffiliateOffers.af_offer_id')
->join('AffiliateCompanies','AffiliateCompanies.af_id = AffiliateOffers.af_id')
->where('Product.status = 1')
->andWhere('AffiliateOffers.status = 1')
->limit(20)
->orderBy('lastlike_time desc,id desc')
->getQuery()
->execute();
// Store it in the cache
$cache->save($cacheKey, $products);
}
really thanks.