disabling cache

67 views
Skip to first unread message

atomly

unread,
Sep 8, 2014, 2:28:04 PM9/8/14
to activate-p...@googlegroups.com
Is it possible to completely turn off the cache in Activate?

I tried adding the following to my context:

  override def liveCacheType = CacheType.weakReferences

  protected lazy val noCache = CustomCache[Entity](
    cacheType = CacheType.softReferences,
    limitOption = Some(0)
  )

  override def customCaches = List(noCache)

But I'm still seeing some caching behavior.

I need to completely turn it off for this app because I am interfacing with a legacy database that is still being written to by another (rails) app as well.

:: atomly ::

[ ato...@atomly.com : www.atomly.com  : http://blog.atomly.com/ ...
[ atomiq records : new york city : +1.347.692.8661 ...
[ e-mail atomly-new...@atomly.com for atomly info and updates ...

Flavio W. Brasil

unread,
Sep 10, 2014, 6:50:07 AM9/10/14
to atomly, activate-p...@googlegroups.com
Hi,

Activate must guarantee that there is only one instance in memory for each entity in the database. Without this guarantee it isn’t possible to ensure many properties that Activate delivers as features. The implication is that if the entity isn’t collected by the GC, it will be shared by different transactions.

Anyway, I think you are trying to use the wrong mechanism. Even if the caching behavior was the one you were expecting, it wouldn’t be capable to ensure consistency. It is possible to recover an entity, do some processing and meanwhile the entity can be modified by the rails app.

The solution for this is the optimistic offline locking. Using it, it is even possible to keep the cache without limits.

Cheers,

-- 
Flavio W. Brasil

--
You received this message because you are subscribed to the Google Groups "Activate Persistence Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to activate-persist...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

atomly

unread,
Sep 11, 2014, 11:35:30 AM9/11/14
to Flavio W. Brasil, activate-p...@googlegroups.com

but in order to do that, don't I have to add the version column to my tables? and doesn't rails have to write to it?

atomly

Flavio W. Brasil

unread,
Sep 11, 2014, 11:41:20 AM9/11/14
to atomly, activate-p...@googlegroups.com
Does the application using Activate perform writes? If not, there is a mechanism to use the update_at field.
If yes, is it possible to create the version column and keep it updated using a trigger? Or even use a view that translates updated_at to version?

Cheers,

-- 
Flavio W. Brasil

atomly

unread,
Sep 11, 2014, 11:47:36 AM9/11/14
to Flavio W. Brasil, activate-p...@googlegroups.com

yes, unfortunately, both sides write... I could try the trigger-- I would then need to do this for every table, right?

the other problem, though, is that I'm seeing stale data-- if I turn on locking for reads and as the trigger, will this be alleviated?

atomly

Flavio W. Brasil

unread,
Sep 20, 2014, 11:29:34 AM9/20/14
to atomly, activate-p...@googlegroups.com
Yes, the optimistic offline locking provides full consistency.

Cheers,

-- 
Flavio W. Brasil

andrewjam...@gmail.com

unread,
Sep 4, 2015, 6:31:43 AM9/4/15
to Activate Persistence Framework
But is it possible to disable caching in activate?
Reply all
Reply to author
Forward
0 new messages