The frequency of cache clearances reported on the Stack Overflow is 
definitely not normal. The reason Memcache was chosen as the default 
session store is because it is cleared infrequently enough so as not to be 
noticed during the course of a single session, and session data is 
typically transient.

On PHP the Cloud Storage stream wrapper 
<https://cloud.google.com/appengine/docs/php/googlestorage/> is probably 
the best choice actually, and it does cache file reads to Memcache. 
<https://cloud.google.com/appengine/docs/php/googlestorage/advanced> This 
is specific to PHP though as on the other runtimes Memcache caching is 
paired with Datastore (as is the case with NDB 
<https://cloud.google.com/appengine/docs/python/ndb/> on Python and 
Objectify <https://github.com/objectify/objectify> on Java), just some 
extra info.

On Tuesday, January 26, 2016 at 11:26:42 AM UTC-5, Alex Kerr wrote:
>
> Actually further to my reply above, I found this old post recommending 
> using Cloud Storage instead: 
> https://groups.google.com/d/msg/google-appengine/ziMU2sXQg7c/5uat0Lxly2sJ
> - is this a good idea? Seems like it at first glance for the reasons 
> mentioned (esp caching in memcache anyway). And adapting the example 
> session handler in the PHP docs should be easy I think: 
> http://php.net/manual/en/class.sessionhandlerinterface.php
>
> This would also be cheap given storage pricing and no data transfer costs 
> either way (in the same region).
>
> Can anyone see any drawbacks here? I'm assuming latency would be low 
> enough to be feasible...? What about if there are a large number of users 
> using my simultaneously - is there a limit to the number of simultaneous 
> streams to/from Cloud storage via the "gs://" file interface?
>
> I don't fully understand how cache would work here though (behind the 
> scenes via the gs:// interface - for a read, how is it known whether a 
> session file needs to be read from the cache or not, and if it's in the 
> cache, what happens if an updated session file was previously written to 
> Cloud Storage by the session handler?
>
> Thanks!
> Alex
>
>
> On Tuesday, January 26, 2016 at 1:23:51 AM UTC, Adam (Cloud Platform 
> Support) wrote:
>>
>> I don't have a code sample, but you would need to create a custom session 
>> handler with session_set_save_handler() 
>> <http://php.net/manual/en/function.session-set-save-handler.php> as per 
>> the suggestion provided in this post 
>> <http://stackoverflow.com/questions/20272634/storing-session-data-in-database-and-memcache>
>>  on 
>> Stack Overflow.
>>
>> On Monday, January 25, 2016 at 3:36:59 PM UTC-5, Alex Kerr wrote:
>>>
>>> Hi,
>>> I'm using standard PHP session stuff for my web app, which means session 
>>> data is stored in App Engine's shared memcache. Google's docs state that 
>>> this can get flushed so any logged in user sessions would fail. How exactly 
>>> do I add use of Datastore (or Cloud Storage?) into this process so that 
>>> memcache is still used unless it gets flushed in which case Datastore is 
>>> referred to? Is there a way to do this that minimises Datastore reads & 
>>> writes and thus minimises cost and latency? I'm ideally after code (or even 
>>> pseudocode) or even better a drop-in library or class :)
>>>
>>> Or, is a flush of the shared memcache so unlikely that it doesn't really 
>>> matter?
>>>
>>> Many thanks.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/ddecba98-8d82-4475-95ba-16369f135b43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to