Committer: vtroitsky
LJSUP-10937: Counter for public entries in journal/community addedU 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;