What is the reason for 'Policy prevented put operation' in google app engine?
The following exception is logged when data is put into the cache.
com.google.app开发者_开发知识库engine.api.memcache.stdimpl.GCacheException: Policy prevented put operation
The data which is stored in the cache:
Map<String, List<Dependents>> dependentMap = new HashMap<String,List<Dependents>>();
In the map key will be an ID and for each ID there will be 0 or more objects (max 5 objects).
The map size is:
dependentMap.size() = 1500 approximately
Policy has been set to MemcacheService.SetPolicy.SET_ALWAYS
, which is the default.
It was working fine but problem started when cache was cleared by calling the clear()
method.
What is the reason and how do I solve the problem?
If dependentMap.size()
is 1500 and each list has up to 5 objects, then you're storing up to 7500 objects in a single data structure, correct? It is probably the case that, with your data + the internal data representation that Java maintains, this Map
is larger than 1MB.
Per the Google App Engine quotas/limitations, you cannot store any data structure larger than 1MB into memcache or into the datastore. This is the reason you are getting the Exception -- Google is not allowing this Map
to be inserted into Memcache because of its size. I don't think calling clear()
has anything to do with your problem.
精彩评论