summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Avatar.php6
-rw-r--r--classes/Confirm_address.php6
-rw-r--r--classes/Consumer.php6
-rw-r--r--classes/Fave.php6
-rw-r--r--classes/Foreign_link.php6
-rw-r--r--classes/Foreign_service.php6
-rw-r--r--classes/Foreign_subscription.php6
-rw-r--r--classes/Foreign_user.php6
-rw-r--r--classes/Invitation.php6
-rw-r--r--classes/Memcached_Object.php144
-rw-r--r--classes/Message.php6
-rw-r--r--classes/Nonce.php6
-rw-r--r--classes/Notice.php6
-rw-r--r--classes/Notice_source.php6
-rw-r--r--classes/Notice_tag.php6
-rw-r--r--classes/Profile.php6
-rw-r--r--classes/Queue_item.php6
-rw-r--r--classes/Remember_me.php6
-rw-r--r--classes/Remote_profile.php6
-rw-r--r--classes/Reply.php6
-rw-r--r--classes/Sms_carrier.php6
-rw-r--r--classes/Subscription.php6
-rw-r--r--classes/Token.php6
-rw-r--r--classes/User.php13
-rw-r--r--classes/User_openid.php6
25 files changed, 222 insertions, 73 deletions
diff --git a/classes/Avatar.php b/classes/Avatar.php
index 7aaf787b2..ad5ccd7ba 100644
--- a/classes/Avatar.php
+++ b/classes/Avatar.php
@@ -2,9 +2,9 @@
/**
* Table Definition for avatar
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Avatar extends DB_DataObject
+class Avatar extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -21,7 +21,7 @@ class Avatar extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Avatar',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Avatar',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Confirm_address.php b/classes/Confirm_address.php
index f18d554a3..9f28dda73 100644
--- a/classes/Confirm_address.php
+++ b/classes/Confirm_address.php
@@ -2,9 +2,9 @@
/**
* Table Definition for confirm_address
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Confirm_address extends DB_DataObject
+class Confirm_address extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -20,7 +20,7 @@ class Confirm_address extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Confirm_address',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Consumer.php b/classes/Consumer.php
index 6f4513f33..5e457a3fc 100644
--- a/classes/Consumer.php
+++ b/classes/Consumer.php
@@ -2,9 +2,9 @@
/**
* Table Definition for consumer
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Consumer extends DB_DataObject
+class Consumer extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -16,7 +16,7 @@ class Consumer extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Consumer',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Consumer',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Fave.php b/classes/Fave.php
index 572dc232e..67cdf2cca 100644
--- a/classes/Fave.php
+++ b/classes/Fave.php
@@ -2,9 +2,9 @@
/**
* Table Definition for fave
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Fave extends DB_DataObject
+class Fave extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -15,7 +15,7 @@ class Fave extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Fave',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Fave',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php
index 0c6df8ffc..ba6624d06 100644
--- a/classes/Foreign_link.php
+++ b/classes/Foreign_link.php
@@ -2,9 +2,9 @@
/**
* Table Definition for foreign_link
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Foreign_link extends DB_DataObject
+class Foreign_link extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -21,7 +21,7 @@ class Foreign_link extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Foreign_link',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Foreign_service.php b/classes/Foreign_service.php
index ec38c5417..61aa4616e 100644
--- a/classes/Foreign_service.php
+++ b/classes/Foreign_service.php
@@ -2,9 +2,9 @@
/**
* Table Definition for foreign_service
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Foreign_service extends DB_DataObject
+class Foreign_service extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -17,7 +17,7 @@ class Foreign_service extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Foreign_service',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_service',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Foreign_subscription.php b/classes/Foreign_subscription.php
index b8cbed8ca..742ea3333 100644
--- a/classes/Foreign_subscription.php
+++ b/classes/Foreign_subscription.php
@@ -2,9 +2,9 @@
/**
* Table Definition for foreign_subscription
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Foreign_subscription extends DB_DataObject
+class Foreign_subscription extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -16,7 +16,7 @@ class Foreign_subscription extends DB_DataObject
public $created; // datetime() not_null
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Foreign_subscription',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_subscription',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php
index 2b6e81015..f1ad6e6dc 100644
--- a/classes/Foreign_user.php
+++ b/classes/Foreign_user.php
@@ -2,9 +2,9 @@
/**
* Table Definition for foreign_user
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Foreign_user extends DB_DataObject
+class Foreign_user extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -18,7 +18,7 @@ class Foreign_user extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Foreign_user',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Invitation.php b/classes/Invitation.php
index cc3c3b937..a025d10b1 100644
--- a/classes/Invitation.php
+++ b/classes/Invitation.php
@@ -2,9 +2,9 @@
/**
* Table Definition for invitation
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Invitation extends DB_DataObject
+class Invitation extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -17,7 +17,7 @@ class Invitation extends DB_DataObject
public $created; // datetime() not_null
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Invitation',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Memcached_Object.php b/classes/Memcached_Object.php
new file mode 100644
index 000000000..a11c9883f
--- /dev/null
+++ b/classes/Memcached_Object.php
@@ -0,0 +1,144 @@
+<?php
+/*
+ * Laconica - a distributed open-source microblogging tool
+ * Copyright (C) 2008, Controlez-Vous, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if (!defined('LACONICA')) { exit(1); }
+
+require_once 'classes/Memcached_DataObject.php';
+
+class Memcached_DataObject extends DB_DataObject
+{
+ static function &staticGet($cls, $k, $v=NULL) {
+ $i = $this->getcached($cls, $k, $v);
+ if (!is_null($i)) {
+ return $i;
+ } else {
+ $i = parent::staticGet($k, $v);
+ if (!is_null($i)) {
+ $i->encache();
+ }
+ return $i;
+ }
+ }
+
+ function insert() {
+ $result = parent::insert();
+ if ($result) {
+ $this->encache();
+ }
+ return $result;
+ }
+
+ function update($orig=NULL) {
+ if (!is_null($orig)) {
+ $orig->decache(); # might be different keys
+ }
+ $result = parent::update($orig);
+ if ($result) {
+ $this->encache();
+ }
+ }
+
+ function delete() {
+ $this->decache(); # while we still have the values!
+ return parent::delete();
+ }
+
+ static function memcache() {
+ if (!common_config('memcached', 'enabled')) {
+ return NULL;
+ } else {
+ $cache = new Memcache();
+ $res = $cache->connect(common_config('memcached', 'server'),
+ common_config('memcached', 'port'));
+ return ($res) ? $cache : NULL;
+ }
+ }
+
+ static function cacheKey($cls, $k, $v) {
+ return common_cache_key(strtolower($cls) . ':' .
+ $k . ':' .
+ $v);
+ }
+
+ static function getcached($cls, $k, $v) {
+ $c = Memcached_DataObject::memcache();
+ if (!$c) {
+ return false;
+ } else {
+ return $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
+ }
+ }
+
+ function keyTypes() {
+ global $_DB_DATAOBJECT;
+ if (!isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"])) {
+ $this->databaseStructure();
+
+ }
+ return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
+ }
+
+ function encache() {
+ $c = $this->memcache();
+ if (!$c) {
+ return false;
+ } else {
+ $primary = array();
+ $types = ksort($this->keyTypes());
+ foreach ($types as $key => $type) {
+ if ($type == 'K') {
+ $primary[] = $key;
+ } else {
+ $c->set($this->cacheKey($this->tableName(), $key, $this->$key),
+ $this);
+ }
+ }
+ # XXX: figure out what to do with compound pkeys
+ if (count($primary) == 1) {
+ $key = $primary[0];
+ $c->set($this->cacheKey($this->tableName(), $key, $this->$key),
+ $this);
+ }
+ }
+ }
+
+ function decache() {
+ $c = $this->memcache();
+ if (!$c) {
+ return false;
+ } else {
+ $primary = array();
+ $types = ksort($this->keyTypes());
+ foreach ($types as $key => $type) {
+ if ($type == 'K') {
+ $primary[] = $this->$key;
+ } else {
+ $c->delete($this->cacheKey($this->tableName(), $key, $this->$key),
+ $this);
+ }
+ }
+ # XXX: figure out what to do with compound pkeys
+ if (count($primary) == 1) {
+ $key = $primary[0];
+ $c->delete($this->cacheKey($this->tableName(), $key, $this->$key),
+ $this);
+ }
+ }
+ }
+}
diff --git a/classes/Message.php b/classes/Message.php
index a903161f7..12ec10846 100644
--- a/classes/Message.php
+++ b/classes/Message.php
@@ -2,9 +2,9 @@
/**
* Table Definition for message
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Message extends DB_DataObject
+class Message extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -22,7 +22,7 @@ class Message extends DB_DataObject
public $source; // varchar(32)
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Message',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Message',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Nonce.php b/classes/Nonce.php
index 987e8d1e8..258726c1e 100644
--- a/classes/Nonce.php
+++ b/classes/Nonce.php
@@ -2,9 +2,9 @@
/**
* Table Definition for nonce
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Nonce extends DB_DataObject
+class Nonce extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -18,7 +18,7 @@ class Nonce extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Nonce',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Nonce',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Notice.php b/classes/Notice.php
index 2d880f8cb..4af81f919 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -22,9 +22,9 @@ if (!defined('LACONICA')) { exit(1); }
/**
* Table Definition for notice
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Notice extends DB_DataObject
+class Notice extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -43,7 +43,7 @@ class Notice extends DB_DataObject
public $source; // varchar(32)
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Notice',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Notice_source.php b/classes/Notice_source.php
index fe6d3d4f1..b05ee9f56 100644
--- a/classes/Notice_source.php
+++ b/classes/Notice_source.php
@@ -2,9 +2,9 @@
/**
* Table Definition for notice_source
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Notice_source extends DB_DataObject
+class Notice_source extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -17,7 +17,7 @@ class Notice_source extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Notice_source',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_source',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php
index 3731d8414..5dca41a7a 100644
--- a/classes/Notice_tag.php
+++ b/classes/Notice_tag.php
@@ -2,9 +2,9 @@
/**
* Table Definition for notice_tag
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Notice_tag extends DB_DataObject
+class Notice_tag extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -15,7 +15,7 @@ class Notice_tag extends DB_DataObject
public $created; // datetime() not_null
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Notice_tag',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Profile.php b/classes/Profile.php
index 5f88caf2c..ab1880470 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -22,9 +22,9 @@ if (!defined('LACONICA')) { exit(1); }
/**
* Table Definition for profile
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Profile extends DB_DataObject
+class Profile extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -41,7 +41,7 @@ class Profile extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Profile',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Queue_item.php b/classes/Queue_item.php
index 14d2e34b5..2fb5b2920 100644
--- a/classes/Queue_item.php
+++ b/classes/Queue_item.php
@@ -2,9 +2,9 @@
/**
* Table Definition for queue_item
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Queue_item extends DB_DataObject
+class Queue_item extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -16,7 +16,7 @@ class Queue_item extends DB_DataObject
public $claimed; // datetime()
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Queue_item',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Queue_item',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Remember_me.php b/classes/Remember_me.php
index c84668c46..9c86ebf02 100644
--- a/classes/Remember_me.php
+++ b/classes/Remember_me.php
@@ -2,9 +2,9 @@
/**
* Table Definition for remember_me
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Remember_me extends DB_DataObject
+class Remember_me extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -15,7 +15,7 @@ class Remember_me extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Remember_me',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Remote_profile.php b/classes/Remote_profile.php
index e5613125d..5afc85d20 100644
--- a/classes/Remote_profile.php
+++ b/classes/Remote_profile.php
@@ -22,9 +22,9 @@ if (!defined('LACONICA')) { exit(1); }
/**
* Table Definition for remote_profile
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Remote_profile extends DB_DataObject
+class Remote_profile extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -38,7 +38,7 @@ class Remote_profile extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Remote_profile',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Remote_profile',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Reply.php b/classes/Reply.php
index 8e26f1684..2c364ecae 100644
--- a/classes/Reply.php
+++ b/classes/Reply.php
@@ -2,9 +2,9 @@
/**
* Table Definition for reply
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Reply extends DB_DataObject
+class Reply extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -16,7 +16,7 @@ class Reply extends DB_DataObject
public $replied_id; // int(4)
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Reply',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Reply',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Sms_carrier.php b/classes/Sms_carrier.php
index 26a88e360..10ccb9283 100644
--- a/classes/Sms_carrier.php
+++ b/classes/Sms_carrier.php
@@ -2,9 +2,9 @@
/**
* Table Definition for sms_carrier
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Sms_carrier extends DB_DataObject
+class Sms_carrier extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -17,7 +17,7 @@ class Sms_carrier extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Sms_carrier',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Sms_carrier',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Subscription.php b/classes/Subscription.php
index 2a1037d2b..cf6a3e57e 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -22,9 +22,9 @@ if (!defined('LACONICA')) { exit(1); }
/**
* Table Definition for subscription
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Subscription extends DB_DataObject
+class Subscription extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -38,7 +38,7 @@ class Subscription extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Subscription',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Subscription',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/Token.php b/classes/Token.php
index a91b19f8e..ef7ee20c0 100644
--- a/classes/Token.php
+++ b/classes/Token.php
@@ -2,9 +2,9 @@
/**
* Table Definition for token
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class Token extends DB_DataObject
+class Token extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -19,7 +19,7 @@ class Token extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Token',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Token',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
diff --git a/classes/User.php b/classes/User.php
index 643069782..ec57e52a9 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -27,11 +27,11 @@ define('WITHFRIENDS_CACHE_WINDOW', 61);
/**
* Table Definition for user
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
require_once 'Validate.php';
require_once(INSTALLDIR.'/lib/noticewrapper.php');
-class User extends DB_DataObject
+class User extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -65,7 +65,7 @@ class User extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('User',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
@@ -109,7 +109,12 @@ class User extends DB_DataObject
}
$qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
' WHERE id = ' . $this->id;
- return $this->query($qry);
+ $orig->decache();
+ $result = $this->query($qry);
+ if ($result) {
+ $this->encache();
+ }
+ return $result;
}
function allowed_nickname($nickname) {
diff --git a/classes/User_openid.php b/classes/User_openid.php
index 67f6f3b2e..b65685ce7 100644
--- a/classes/User_openid.php
+++ b/classes/User_openid.php
@@ -2,9 +2,9 @@
/**
* Table Definition for user_openid
*/
-require_once 'DB/DataObject.php';
+require_once 'classes/Memcached_DataObject.php';
-class User_openid extends DB_DataObject
+class User_openid extends Memcached_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
@@ -17,7 +17,7 @@ class User_openid extends DB_DataObject
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('User_openid',$k,$v); }
+ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_openid',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE