John means you don't have to worry about "synchronized", but be aware of
Memcache race conditions if you do frequent reads and saves from Memcache.
You can't lock Memcache.

On Thu, Feb 4, 2010 at 11:06 AM, John Patterson <[email protected]>wrote:

> You don't need to worry about concurrency in your code - you cannot use
> multiple threads.
>
> The MemcacheService is already a singleton accessible with the
> MemcacheServiceFactory so no need to make another.  Personally I inject a
> single MemcacheService instance into my objects with Guice.  But you could
> just as well call the factory method whenever you need it.
>
>
> On 4 Feb 2010, at 22:00, Fux wrote:
>
>  Hi everyone!
>>
>> I have a question, are there any good examples of how Memcache should
>> be used in a real world case?
>>
>> I mean, where should a cache be created?
>>
>> If I created a Cache for caching some data used by a servlet, should I
>> create and store the instance in the servlet context on init or just
>> make a singleton or what?
>>
>> Also, will it need to be Synchronized or not?
>>
>> I am sorry if the question is a fairly newbie-ish but I am fairly new
>> to Google App Engine and, in general, web development plus I couldn't
>> really find good code samples...
>>
>> Just to make it clear... I don't need to know how data should be put/
>> removed into the cache (I might need to know about synchronization
>> issues though) but really how to create/destroy a cache, where to
>> store it and how to make sure it's accessed correctly.
>>
>> Thanks a lot!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-appengine-java%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to