public function testCache() { $source = new CM_PagingSource_Sql('`num`', 'test'); $source->enableCache(); $this->assertSame(100, $source->getCount()); $sourceNocache = new CM_PagingSource_Sql('`num`', 'test'); $this->assertSame(100, $sourceNocache->getCount()); CM_Db_Db::delete('test', array('num' => 0)); $this->assertSame(100, $source->getCount()); $this->assertSame(99, $sourceNocache->getCount()); $source->clearCache(); $this->assertSame(99, $source->getCount()); $this->assertSame(99, $sourceNocache->getCount()); CM_Cache_Shared::getInstance()->flush(); }
public function testCacheCustom() { $source = new CM_PagingSource_Sql('`num`', 'test'); $fileCache = CM_Cache_Persistent::getInstance(); $source->enableCache(null, $fileCache); $this->assertEquals(100, $source->getCount()); CM_Db_Db::delete('test', array('num' => 0)); $this->assertEquals(100, $source->getCount()); $source->clearCache(); $this->assertEquals(99, $source->getCount()); CM_Db_Db::delete('test', array('num' => 1)); $this->assertEquals(99, $source->getCount()); $fileCache->flush(); $this->assertEquals(98, $source->getCount()); }
public function __construct() { $source = new CM_PagingSource_Sql('id, abbreviation', 'cm_model_language'); $source->enableCache(); parent::__construct($source); }
public function __construct(CM_Model_StreamChannel_Abstract $streamChannel) { $source = new CM_PagingSource_Sql('DISTINCT `userId`', 'cm_stream_publish', '`channelId` = ' . $streamChannel->getId()); $source->enableCache(); parent::__construct($source); }
public function __construct() { $source = new CM_PagingSource_Sql('id', 'cm_model_currency', null, 'id'); $source->enableCache(); parent::__construct($source); }
/** * @param int $channelId $streamChannelArchive */ public function __construct($channelId) { $source = new CM_PagingSource_Sql('id', 'cm_streamchannel_thumbnail', 'channelId = ?', 'createStamp', null, null, [(int) $channelId]); $source->enableCache(); parent::__construct($source); }
/** * @param CM_Model_Splittest $splittest */ public function __construct(CM_Model_Splittest $splittest) { $source = new CM_PagingSource_Sql('id', 'cm_splittestVariation', '`splittestId`=' . $splittest->getId() . ' AND `enabled`=1'); $source->enableCache(); parent::__construct($source); }
/** * @param CM_Model_StreamChannel_Abstract $streamChannel */ public function __construct(CM_Model_StreamChannel_Abstract $streamChannel) { $source = new CM_PagingSource_Sql('`id`', 'cm_stream_subscribe', '`channelId` = ' . $streamChannel->getId()); $source->enableCache(); return parent::__construct($source); }