countCollections() public method

Return the count of available collections in the cache
public countCollections ( )
Ejemplo n.º 1
0
 /**
  * Return the count of collections in the cache only.
  *
  * @return integer
  */
 public function cachedCollectionCount()
 {
     return $this->_cache->countCollections();
 }
Ejemplo n.º 2
0
Archivo: Base.php Proyecto: horde/horde
 protected function _testCacheCollections()
 {
     $collections = array('519422f1-4c5c-4547-946a-1701c0a8015f' => array('class' => 'Email', 'windowsize' => 5, 'truncation' => 0, 'mimesupport' => 0, 'mimetruncation' => 8, 'conflict' => 1, 'bodyprefs' => array('wanted' => 2, 2 => array('type' => 2, 'truncationsize' => 200000)), 'deletesasmoves' => 1, 'filtertype' => 5, 'id' => '519422f1-4c5c-4547-946a-1701c0a8015f', 'serverid' => 'INBOX'), '@Contacts@' => array('class' => 'Contacts', 'windowsize' => 4, 'truncation' => 0, 'mimesupport' => 0, 'mimetruncation' => 8, 'conflict' => 1, 'bodyprefs' => array('wanted' => 1, 1 => array('type' => 1, 'truncationsize' => 200000)), 'deletesasmoves' => 1, 'id' => '@Contacts@', 'serverid' => '@Contacts@'));
     $cache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger());
     foreach ($collections as $collection) {
         $cache->addCollection($collection);
     }
     // Mangle the fixture to match what we expect.
     $collections['519422f1-4c5c-4547-946a-1701c0a8015f']['rtftruncation'] = null;
     $collections['@Contacts@']['rtftruncation'] = null;
     $collections['@Contacts@']['filtertype'] = null;
     $this->assertEquals(2, $cache->countCollections());
     $this->assertEquals($collections, $cache->getCollections(false));
     $this->assertEquals(array(), $cache->getCollections(true));
     $this->assertEquals(true, $cache->collectionExists('@Contacts@'));
     $this->assertEquals(true, $cache->collectionExists('519422f1-4c5c-4547-946a-1701c0a8015f'));
     $this->assertEquals(false, $cache->collectionExists('foo'));
     $this->assertEquals(false, $cache->collectionIsPingable('@Contacts@'));
     $cache->setPingableCollection('@Contacts@');
     $this->assertEquals(true, $cache->collectionIsPingable('@Contacts@'));
     $cache->removePingableCollection('@Contacts@');
     $this->assertEquals(false, $cache->collectionIsPingable('@Contacts@'));
     $cache->updateCollection(array('id' => '519422f1-4c5c-4547-946a-1701c0a8015f', 'newsynckey' => '{51941e99-0b9c-41f8-b678-1532c0a8015f}2'), array('newsynckey' => true));
     $cache->save();
     // Now we should have a lastsynckey
     $this->assertEquals(1, count($cache->getCollections()));
     // And still have 2 if we don't need a synckey
     $this->assertEquals(2, count($cache->getCollections(false)));
 }