Hi GAE Team
First, I want to say that this is a great system. I like the
collaboration, and total outcome of GAE.
Now to my issue. I am sure I am doing something wrong, but after I
implemented caching on my test application, i see that my caching
policies are not taking effect. Basically keeping things in the
MEMCache as long as the system likes.
Basically I retrieve a list of posts, put them on the cache, and any
subsequent request will get the list from the cache for the next 10
seconds. After that it should get the list from datastore, and put it
again on the cache.
below part of my code:
Constructor of Class:
public NoteRepository()
{
query = "select from " + SmallNote.class.getName();
HashMap<Integer, Integer> cacheProp = new HashMap<Integer,
Integer>();
cacheProp.put(GCacheFactory.EXPIRATION_DELTA, 10);
try
{
CacheFactory cacheFactory =
CacheManager.getInstance().getCacheFactory();
cache = cacheFactory.createCache(cacheProp);
}
catch (CacheException e)
{
log.info(e.getMessage());
}
}
Get list method:
public List<SmallNote> GetNotes()
{
List<SmallNote> notes = new ArrayList<SmallNote>();
notes = (ArrayList<SmallNote>)cache.get(1);
if(notes==null)
{
notes = (List<SmallNote>) pm.newQuery(query).execute();
ArrayList<SmallNote> cNotes = new
ArrayList<SmallNote>();
cNotes.addAll(notes);
cache.put(1, cNotes);
}
return notes;
}
On the second line of the second method GetNotes(), it will always
return the cache disregarding the 10 seconds expiration delta placed
initially.
Any ideas?
Thanks, Geo
--
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.