# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-
-# Simple generic object store
-# interface is intended to be more or less compatible with
-# the PHP memcached client.
-#
-# backends for local hash array and SQL table included:
-# $bag = new HashBagOStuff();
-# $bag = new MysqlBagOStuff($tablename); # connect to db first
-
-class /* abstract */ BagOStuff {
+/**
+ *
+ * @package MediaWiki
+ */
+
+/**
+ * Simple generic object store
+ *
+ * interface is intended to be more or less compatible with
+ * the PHP memcached client.
+ *
+ * backends for local hash array and SQL table included:
+ * $bag = new HashBagOStuff();
+ * $bag = new MysqlBagOStuff($tablename); # connect to db first
+ *
+ * @package MediaWiki
+ * @abstract
+ */
+class BagOStuff {
var $debugmode;
function BagOStuff() {
}
-/* Functional versions! */
+/**
+ * Functional versions!
+ * @todo document
+ * @package MediaWiki
+ */
class HashBagOStuff extends BagOStuff {
/*
This is a test of the interface, mainly. It stores
key (exptime)
);
*/
-class /* abstract */ SqlBagOStuff extends BagOStuff {
+
+/**
+ * @todo document
+ * @abstract
+ * @package MediaWiki
+ */
+class SqlBagOStuff extends BagOStuff {
var $table;
+
function SqlBagOStuff($tablename = 'objectcache') {
$this->table = $tablename;
}
return true; /* ? */
}
+ function getTableName() {
+ return $this->table;
+ }
+
function _query($sql) {
$reps = func_get_args();
- $reps[0] = $this->table;
+ $reps[0] = $this->getTableName();
// ewwww
for($i=0;$i<count($reps);$i++) {
$sql = str_replace(
}
}
+/**
+ * @todo document
+ * @package MediaWiki
+ */
class MediaWikiBagOStuff extends SqlBagOStuff {
+ var $tableInitialised = false;
+
function _doquery($sql) {
$dbw =& wfGetDB( DB_MASTER );
return $dbw->query($sql, 'MediaWikiBagOStuff:_doquery');
$dbw =& wfGetDB( DB_MASTER );
return $dbw->strencode($s);
}
+ function getTableName() {
+ if ( !$this->tableInitialised ) {
+ $dbw =& wfGetDB( DB_MASTER );
+ $this->table = $dbw->tableName( $this->table );
+ $this->tableInitialised = true;
+ }
+ return $this->table;
+ }
}
+/**
+ * @todo document
+ * @package MediaWiki
+ */
class TurckBagOStuff extends BagOStuff {
function get($key) {
return mmcache_get( $key );