0

I tested cache configuration on a particular entity Product, related linkedin discussion here.

I have a cache item configuration as

<cache name="entity.record.one.mantle.product.Product" expire-time-idle="60" expire-time-live="600"/>

enter image description here

There are problems:

  • expire-time-live seems not updated as it is not displayed on CacheList page of Tools app.

  • although expire to idle is set to 60s, when product name is updated with 60s (actually test <10s), the product got from cache returns updated product name.

I am not sure if second one is desired behavior. Perhaps the product update clears the cache by framework. If it is, then it is wonderful feature. If not, then it should a problem, it means the result is not coming from cache.

Pramod Gharu
  • 1,105
  • 3
  • 9
  • 18
Jimmy Shen
  • 240
  • 1
  • 12
  • I run a test, it seems second one is desired behavior. Once it is updated, the cache is removed and next time access will miss and get new update value. – Jimmy Shen Aug 15 '16 at 04:57

1 Answers1

1

On point 1: Only one expire time is allowed, either idle or live, and if both are specified the idle expire time is used. Basically an underlying cache can have one expiration policy which has a type (idle, live) and time in seconds.

On point 2: Yes, that is the expected behavior. The automatic cache clearing should always work when a record is updated if it is cached, even cached view entities and lists of values. There is fairly elaborate code to handle this, and various automated tests to make sure it works in different scenarios.

When deploying with multiple application servers the currently recommended approach to handle automated cache clearing across all servers, no matter which server a record (entity value) is changed on, is to use the moqui-hazelcast component which uses a distributed topic to send messages about updated records that each server can use for its automatic cache clearing based on what each server has cached.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8