/** * @param int $type OPTIONAL */ public function __construct($type = null) { $where = null; if ($type) { $type = (int) $type; $where = '`type` = ' . $type; } $source = new CM_PagingSource_Sql('DISTINCT `actionType`, `actionVerb`, `type`', 'cm_actionLimit', $where, '`type`, `actionType`, `actionVerb`'); $source->enableCacheLocal(); parent::__construct($source); }
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); }
/** * @param CM_Action_Abstract $action */ public function __construct(CM_Action_Abstract $action) { $source = new CM_PagingSource_Sql('DISTINCT `actionType`, `actionVerb`, `type`', 'cm_actionLimit', '`actionType` = ' . $action->getType() . ' AND `actionVerb` = ' . $action->getVerb(), '`type`'); $source->enableCacheLocal(); parent::__construct($source); }
public function __construct() { $source = new CM_PagingSource_Sql('`ip`', 'cm_ipBlocked'); $source->enableCacheLocal(60); 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()); $source->enableCacheLocal(86400); 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); }
public function __construct() { $source = new CM_PagingSource_Sql('userId', 'cm_user_online'); $source->enableCacheLocal(1); parent::__construct($source); }
public function __construct() { $source = new CM_PagingSource_Sql('name', 'cm_splitfeature'); $source->enableCacheLocal(); parent::__construct($source); }
public function __construct() { $source = new CM_PagingSource_Sql('name', 'cm_splittest', null, 'createStamp'); $source->enableCacheLocal(); 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); }