[Building Sakai] cache automatically updates itself?
Aaron Zeckoski
azeckoski at unicon.net
Sat May 29 01:02:03 PDT 2010
Are these hibernate objects and are you talking about the hibernate
cache or is this simply an object you are placing into the in-memory
cache in the memory service?
-AZ
On Sat, May 29, 2010 at 12:13 AM, Steve Swinsburg
<steve.swinsburg at gmail.com> wrote:
> Hi all,
>
> I have a cache in my app that caches objects loaded from the database so that subsequent requests use the cached version and don't hit the database again.
>
> On one of my pages I allow a user to update their own version of the object and it is saved to the database. What I am seeing however, is that this change is also reflected in the cached version, ie they are kept in sync. Is this normal behaviour? I haven't specifically coded for updates to be readded to the cache, I was just testing and noticed this was happening anyway. I am not sure if it's expected behaviour so will explicitly update the cache with the updated verison when it's saved.
>
> Some pseudocode of what I have at the moment:
>
> getRecord(userId) {
>
> check cache
> if exists in cache, returned cached version
>
> if not get from db and add to cache for future lookups
> }
>
> updateRecord(object) {
> save object to db
> }
>
> So no explicit cache update in the updateRecord method, but it's happening anyway.
>
> Any input on the Cache/MemoryService appreciated.
>
> cheers,
> Steve
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>
--
Aaron Zeckoski - Software Engineer - http://tinyurl.com/azprofile
More information about the sakai-dev
mailing list