summaryrefslogtreecommitdiff
path: root/framework/Data/TSqliteCache.php
diff options
context:
space:
mode:
authorxue <>2005-11-19 04:35:07 +0000
committerxue <>2005-11-19 04:35:07 +0000
commit8fd040ef49321fce9d3d0b9c44937984a2112b52 (patch)
tree573dcfe6a3ec6d5a3b7fde9298dcc1b4f45116b1 /framework/Data/TSqliteCache.php
parentbc1a7e1e3a67537189d30013ea6d5fa4bf98e8e4 (diff)
Diffstat (limited to 'framework/Data/TSqliteCache.php')
-rw-r--r--framework/Data/TSqliteCache.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/framework/Data/TSqliteCache.php b/framework/Data/TSqliteCache.php
index eac22dd2..5eb692d4 100644
--- a/framework/Data/TSqliteCache.php
+++ b/framework/Data/TSqliteCache.php
@@ -17,7 +17,8 @@
*
* The database file is specified by the DbFile property. This property must
* be set before {@link init} is invoked. If the specified database file does not
- * exist, it will be created automatically. Make sure the database file is writable.
+ * exist, it will be created automatically. Make sure the directory containing
+ * the specified DB file and the file itself must be writable by the Web server process.
*
* The following basic cache operations are implemented:
* - {@link get} : retrieve the value with a key (if any) from cache
@@ -50,6 +51,14 @@
* $object2=$cache->get('object');
* </code>
*
+ * If loaded, TSqliteCache will register itself with {@link TApplication} as the
+ * cache module. It can be accessed via {@link TApplication::getCache()}.
+ *
+ * TMemCache may be configured in application configuration file as follows
+ * <module id="cache" type="System.Data.TSqliteCache" DbFile="Application.Data.site" />
+ * where {@link getDbFile DbFile} is a property specifying the location of the
+ * SQLite DB file (in the namespace format).
+ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
* @package System.Data
@@ -113,11 +122,9 @@ class TSqliteCache extends TComponent implements IModule, ICache
if(!function_exists('sqlite_open'))
throw new TConfigurationException('sqlitecache_extension_required');
if($this->_file===null)
- throw new TConfigurationException('sqlitecache_filename_required');
+ throw new TConfigurationException('sqlitecache_dbfile_required');
$error='';
- if(($fname=Prado::getPathOfNamespace($this->_file,self::DB_FILE_EXT))===null)
- throw new TConfigurationException('sqlitecache_dbfile_invalid',$this->_file);
- if(($this->_db=new SQLiteDatabase($fname,0666,$error))===false)
+ if(($this->_db=new SQLiteDatabase($this->_file,0666,$error))===false)
throw new TConfigurationException('sqlitecache_connection_failed',$error);
if(($res=$this->_db->query('SELECT * FROM sqlite_master WHERE tbl_name=\''.self::CACHE_TABLE.'\' AND type=\'table\''))!=false)
{
@@ -166,8 +173,8 @@ class TSqliteCache extends TComponent implements IModule, ICache
{
if($this->_initialized)
throw new TInvalidOperationException('sqlitecache_dbfile_unchangeable');
- else
- $this->_file=$value;
+ else if(($this->_file=Prado::getPathOfNamespace($value,self::DB_FILE_EXT))===null)
+ throw new TConfigurationException('sqlitecache_dbfile_invalid',$value);
}
/**