]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
subscriptions clear user with-friends cache, too
authorEvan Prodromou <evan@prodromou.name>
Mon, 15 Sep 2008 07:15:00 +0000 (03:15 -0400)
committerEvan Prodromou <evan@prodromou.name>
Mon, 15 Sep 2008 07:15:00 +0000 (03:15 -0400)
darcs-hash:20080915071500-84dde-765c8c289d5cf7f71c2a49967bde4ecda28d9ea8.gz

lib/subs.php

index 383bfa007023c9ba0152e4b1860cfc14475f6ff2..554647d442e34a5a52b33818ed85018a93931555 100644 (file)
@@ -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;
 
 }