Changeset 2332
- Timestamp:
- 11/08/2007 07:09:06 PM (14 months ago)
- Location:
- trunk/framework
- Files:
-
- 3 modified
-
Caching/TCache.php (modified) (3 diffs)
-
Data/ActiveRecord/TActiveRecord.php (modified) (1 diff)
-
Data/DataGateway/TTableGateway.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/framework/Caching/TCache.php
r1995 r2332 39 39 * and optionally {@link flush} 40 40 * 41 * Since version 3.1.2, TCache implements the ArrayAccess interface such that 42 * the cache acts as an array. 43 * 41 44 * @author Qiang Xue <qiang.xue@gmail.com> 42 45 * @version $Id$ … … 44 47 * @since 3.0 45 48 */ 46 abstract class TCache extends TModule implements ICache 49 abstract class TCache extends TModule implements ICache, ArrayAccess 47 50 { 48 51 private $_prefix=null; … … 232 235 */ 233 236 abstract protected function deleteValue($key); 237 238 /** 239 * Returns whether there is a cache entry with a specified key. 240 * This method is required by the interface ArrayAccess. 241 * @param string a key identifying the cached value 242 * @return boolean 243 */ 244 public function offsetExists($id) 245 { 246 return $this->get($id) !== false; 247 } 248 249 /* 250 * Retrieves the value from cache with a specified key. 251 * This method is required by the interface ArrayAccess. 252 * @param string a key identifying the cached value 253 * @return mixed the value stored in cache, false if the value is not in the cache or expired. 254 */ 255 public function offsetGet($id) 256 { 257 return $this->get($id); 258 } 259 260 /* 261 * Stores the value identified by a key into cache. 262 * If the cache already contains such a key, the existing value will be 263 * replaced with the new ones. To add expiration and dependencies, use the set() method. 264 * This method is required by the interface ArrayAccess. 265 * @param string the key identifying the value to be cached 266 * @param mixed the value to be cached 267 */ 268 public function offsetSet($id, $value) 269 { 270 $this->set($id, $value); 271 } 272 273 /* 274 * Deletes the value with the specified key from cache 275 * This method is required by the interface ArrayAccess. 276 * @param string the key of the value to be deleted 277 * @return boolean if no error happens during deletion 278 */ 279 public function offsetUnset($id) 280 { 281 $this->delete($id); 282 } 234 283 } 235 284 -
trunk/framework/Data/ActiveRecord/TActiveRecord.php
r2331 r2332 521 521 $record=new $type($data); 522 522 $record->_recordState=self::STATE_LOADED; 523 $record->copyFrom($data);524 523 return $record; 525 524 } -
trunk/framework/Data/DataGateway/TTableGateway.php
r1902 r2332 117 117 $meta = TDbMetaData::getInstance($this->getDbConnection()); 118 118 $this->initCommandBuilder($meta->createCommandBuilder($tableName)); 119 } 120 121 public function getTableInfo() 122 { 123 return $this->getCommand()->getTableInfo(); 124 } 125 126 public function getTableName() 127 { 128 return $this->getTableInfo()->getTableName(); 119 129 } 120 130
