Currently we have separate API functions for determining if a user voted and for retrieving the vote array. We cache the fact that the user voted for a particular node, but not the entire vote. If we cache the entire serialized vote, then we get both a fast cache alternative to querying a large votingapi table, and we can remove the binary decisions_voted functionality.

CommentFileSizeAuthor
#4 737274-b.patch19.19 KBezra-g
#1 737274.patch14.65 KBezra-g

Comments

ezra-g’s picture

Status: Active » Needs review
StatusFileSize
new14.65 KB

Here finally is the patch.

I have tested manually (and updated our tests) to make sure that this works with 1click with JS disabled.

anarcat’s picture

Sounds good... but doesn't votingapi cache stuff on its own?

Otherwise, cosmetically, it would be nice for decisions_get_vote_direct() to have proper documentation..

ezra-g’s picture

The votingapi caches aggregated results for each content_id and tag. However, it doesn't cache the fact that a user voted and both the {votingapi_cache} and {votingapi_vote} can have well over a million rows as we do in our project, so putting the fact that a user voted in its own cache bin, and serving that bin from Memcached replaces long (maybe .8sec) reads with super-fast reads from memcached :).

Stay tuned for proper documentation -- good catch ;).

ezra-g’s picture

StatusFileSize
new19.19 KB

Here's a revised patch. Since we're loading the entire vote in $node->vote, we can get rid of $node->voted and folks can just use !empty($node->vote) to check whether a user has voted. I plan to commit and roll a new release today.

ezra-g’s picture

Status: Needs review » Fixed

I committed virtually this exact patch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.