Changeset 1107
- Timestamp:
- 12/04/07 13:38:45 (9 months ago)
- Files:
-
- trunk/src/main/php/net/stubbles/util/cache/stubCacheContainer.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/cache/stubDefaultCacheStrategy.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/cache/stubFileCacheContainer.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/util/cache/stubAbstractCacheContainerTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/util/cache/stubDefaultCacheStrategyTestCase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/util/cache/stubCacheContainer.php
r742 r1107 80 80 * @return int 81 81 */ 82 public function getCacheTime($key); 82 public function getLifeTime($key); 83 84 /** 85 * returns the timestamp when data associated with $key is cached 86 * 87 * @param string $key 88 * @return int 89 */ 90 public function getStoreTime($key); 83 91 84 92 /** trunk/src/main/php/net/stubbles/util/cache/stubDefaultCacheStrategy.php
r742 r1107 83 83 public function isExpired(stubCacheContainer $container, $key) 84 84 { 85 return ($container->get CacheTime($key) > $this->ttl);85 return ($container->getLifeTime($key) > $this->ttl); 86 86 } 87 87 trunk/src/main/php/net/stubbles/util/cache/stubFileCacheContainer.php
r1064 r1107 112 112 * @return int 113 113 */ 114 public function get CacheTime($key)114 public function getLifeTime($key) 115 115 { 116 116 if ($this->doHas($key) == true) { 117 117 return (time() - filemtime($this->cacheDirectory . DIRECTORY_SEPARATOR . $this->escapeKey($key) . '.cache')); 118 } 119 120 return 0; 121 } 122 123 /** 124 * returns the timestamp when data associated with $key is cached 125 * 126 * @param string $key 127 * @return int 128 */ 129 public function getStoreTime($key) 130 { 131 if ($this->doHas($key) == true) { 132 return filemtime($this->cacheDirectory . DIRECTORY_SEPARATOR . $this->escapeKey($key) . '.cache'); 118 133 } 119 134 trunk/src/test/php/net/stubbles/util/cache/stubAbstractCacheContainerTestCase.php
r742 r1107 33 33 } 34 34 35 public function get CacheTime($key)35 public function getLifeTime($key) 36 36 { 37 37 if ($this->doHas($key) == true) { … … 42 42 } 43 43 44 public function getStoreTime($key) 45 { 46 if ($this->doHas($key) == true) { 47 return $this->data[$key]['time']; 48 } 49 50 return 0; 51 } 52 44 53 protected function doGetSize($key) 45 54 { trunk/src/test/php/net/stubbles/util/cache/stubDefaultCacheStrategyTestCase.php
r741 r1107 61 61 $defaultCacheStrategy = new stubDefaultCacheStrategy(10, 2, 0); 62 62 $mockContainer = new MockstubCacheContainer(); 63 $mockContainer->setReturnValueAt(0, 'get CacheTime', 9);64 $mockContainer->setReturnValueAt(1, 'get CacheTime', 10);65 $mockContainer->setReturnValueAt(2, 'get CacheTime', 11);63 $mockContainer->setReturnValueAt(0, 'getLifeTime', 9); 64 $mockContainer->setReturnValueAt(1, 'getLifeTime', 10); 65 $mockContainer->setReturnValueAt(2, 'getLifeTime', 11); 66 66 67 67 $this->assertFalse($defaultCacheStrategy->isExpired($mockContainer, 'a'));
