sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[livejournal] r21047: LJSUP-10937: Counter for public entries ...

Committer: vtroitsky
LJSUP-10937: Counter for public entries in journal/community added
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2012-01-30 15:31:47 UTC (rev 21046)
+++ trunk/cgi-bin/LJ/User.pm	2012-01-31 06:11:07 UTC (rev 21047)
@@ -4472,6 +4472,17 @@
     }, $expire);
 }
 
+# return the number if public posts
+sub number_of_public_posts {
+    my ($u) = @_;
+    my $memkey = [$u->{userid}, "log2publicct:$u->{userid}"];
+    my $expire = time() + 300;  # 5 min
+    return LJ::MemCache::get_or_set($memkey, sub {
+        return $u->get_post_ids(return => 'count', security => 'public');
+    }, $expire);
+}
+
+
 # return the number of posts that the user actually posted themselves
 sub number_of_posted_posts {
     my $u = shift;

Tags: livejournal, pm, sunnyman, vtroitsky
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments