diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-09-15 03:15:00 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-09-15 03:15:00 -0400 |
commit | d86f95479726d128883a67a14d5924460ec09e4b (patch) | |
tree | 008009d23891782c41b5a78195b6a288380750c7 /lib | |
parent | df724990bdd89a222eb7d5a437f291e7a0926fa7 (diff) |
subscriptions clear user with-friends cache, too
darcs-hash:20080915071500-84dde-765c8c289d5cf7f71c2a49967bde4ecda28d9ea8.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/subs.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/subs.php b/lib/subs.php index 383bfa007..554647d44 100644 --- a/lib/subs.php +++ b/lib/subs.php @@ -43,15 +43,28 @@ function subs_subscribe_user($user,$other_nickname) { subs_notify($other, $user); + if (common_config('memcached', 'enabled')) { + $cache = new Memcache(); + if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) { + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); + } + } + if ($other->autosubscribe && !$other->isSubscribed($user)) { if (!$other->subscribeTo($user)) { return _('Could not subscribe other to you.'); } + if (common_config('memcached', 'enabled')) { + $cache = new Memcache(); + if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) { + $cache->delete(common_cache_key('user:notices_with_friends:' . $other->id)); + } + } + subs_notify($user, $other); } return true; - } function subs_notify($listenee, $listener) { @@ -90,6 +103,13 @@ function subs_unsubscribe_user($user, $other_nickname) { if (!$sub->delete()) return _('Couldn\'t delete subscription.'); + if (common_config('memcached', 'enabled')) { + $cache = new Memcache(); + if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) { + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); + } + } + return true; } |