Exemple #1
0
 /**
  * @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);
 }
Exemple #2
0
 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();
 }
Exemple #3
0
 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());
 }
Exemple #4
0
 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);
 }
Exemple #6
0
 /**
  * @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);
 }
Exemple #7
0
 public function __construct()
 {
     $source = new CM_PagingSource_Sql('`ip`', 'cm_ipBlocked');
     $source->enableCacheLocal(60);
     parent::__construct($source);
 }
Exemple #8
0
 /**
  * @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);
 }
Exemple #9
0
 public function __construct()
 {
     $source = new CM_PagingSource_Sql('id', 'cm_model_currency', null, 'id');
     $source->enableCache();
     parent::__construct($source);
 }
Exemple #10
0
 /**
  * @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);
 }
Exemple #11
0
 public function __construct()
 {
     $source = new CM_PagingSource_Sql('userId', 'cm_user_online');
     $source->enableCacheLocal(1);
     parent::__construct($source);
 }
Exemple #12
0
 public function __construct()
 {
     $source = new CM_PagingSource_Sql('name', 'cm_splitfeature');
     $source->enableCacheLocal();
     parent::__construct($source);
 }
Exemple #13
0
 public function __construct()
 {
     $source = new CM_PagingSource_Sql('name', 'cm_splittest', null, 'createStamp');
     $source->enableCacheLocal();
     parent::__construct($source);
 }
Exemple #14
0
 /**
  * @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);
 }