If I do it this way, how can I know which user id to try to get from the
memcache?

On Wed, Jun 23, 2010 at 4:14 AM, Jan Michael Ibanez <jmiba...@gmail.com>wrote:

>
> On Jun 23, 2010, at 4:11 PM, l.denardo wrote:
>
> > I'm just giving a not-well-thought suggestion, but I'd rather use
> > memcache for this.
> >
> > I guess something like using a time-dependent code as the key (i.e. a
> > counter which increments every 30 seconds) and a list of user ids as
> > the value, and simply doing a get() on the cache for the current
> > counter value would work.
>
> Alternatively, if you only want to see whether the user has polled, you
> could use the key 'user_%s_polled', substituting %s for the user's id, and
> place it in memcache with an expiration time of 30s. Every time you update
> the key, you can reset the expiration time.
>
> In Python, this would look like:
>
>  memcache.set("user_%s_polled" % user, True, time=30)
>
> Simply getting the key would tell you whether or not the user has polled in
> the last 30s. Memcache would then handle expiration; after 30s, the key is
> removed for you.
>
> Jan Michael Ibanez
> jmiba...@gmail.com
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to