You wouldn't - the concept to use mcache would be to make a hash or a token for 
the time second'th element i.e 1-30
store each pole user in the correct element
and then read the users back out of mcache
by looping the 30 or  mcache containers

I did give this some thought last night when i saw your post but i ran out of 
time
the idea would be

lets say we use pole+1 to 30 as a key
pole1 - happened 1 sec ago
pole29 - happened 29 sec ago
pole30 - will be removed when 31 secs elapse - as we set the mcache to destroy 
poles after 30 seconds

then when somone poles we get the time convert it into a number 1-30 being 
second elements in a min - this need some thought!!!! maybe seconds devide by 2 
- something like that
we then add the user_key to to the pole. maybe a dictionary?
then every second when you task runs
you load using a loop pole1....pole30 grab all the keys in the dict and make a 
list
then if you need to load the models for the user you go a db.get(list)

i think that starting to sound like it might work - sure some bright spark can 
add some more detail
hope that helps



 
Regards
 
 
Martin Webb
The information contained in this email is confidential and may contain 
proprietary information. It is meant solely for the intended recipient. Access 
to this email by anyone else is unauthorised. If you are not the intended 
recipient, any disclosure, copying, distribution or any action taken or omitted 
in reliance on this, is prohibited and may be unlawful. No liability or 
responsibility is accepted if information or data is, for whatever reason 
corrupted or does not reach its intended recipient. No warranty is given that 
this email is free of viruses. The views expressed in this email are, unless 
otherwise stated, those of the author 
 
 




________________________________
From: Rye Terrell <ryeterr...@ryeterrell.net>
To: google-appengine@googlegroups.com
Sent: Wed, 23 June, 2010 19:23:53
Subject: Re: [google-appengine] Re: What is a pattern for keeping track of  
current users in google app engine?

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.
>>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.



      

-- 
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