1

We are trying to set up cache expiration in Pivotal Cloud Cache, using Gemfire. We have set up our region in PCF:

Cluster-0 gfsh>describe region --name=/CartTest
 Type  |          Name           | Value
------ | ----------------------- | ---------
Region | data-policy             | PARTITION
       | entry-idle-time.timeout | 60
       | size                    | 0
       | statistics-enabled      | true
       | entry-idle-time.action  | DESTROY

When we create our Cart object, it is written to the cache (we can see it in the size entry above).

If we access our object from our code, it does not seem to be updating the access time for the entry. For instance:
@11:00:00 - create entry
@11:00:30 - access entry
@11:01:00 - entry is gone

I would have expected the entry to still exist until 11:01:30 (I'm using ridiculously short timeouts just for testing). The idle time almost seems to be acting just like Time-To-Live. When we look at the lastAccessTime for the region using gfsh, it is not being updated.

Any idea what I'm doing wrong here?

Westy
  • 169
  • 2
  • 15

2 Answers2

1

Few things to verify.

  • Can you please share code showing how you store data in PCC regions ?
  • Is the region name correct ? Since you are using region CarTest in gfsh your @Region annotation (assuming you are using spring-data-gemfire on the client side) should also be using CarTest region name.

Easy way to put data using SDG (spring-data-gemfire) is via Spring Data Repository abstraction.

Please refer sample application here. Specifically domain class can be created like here and repository can be created like here

srikanth
  • 1,211
  • 2
  • 9
  • 11
  • Thanks. I created a Gist here: https://gist.github.com/dlwester-0510862/6b1310ea6ff1647b35a2b5f4e86566c8 – Westy Jan 04 '19 at 20:07
0

CORRECTION: The reason the lastAccessedTime was not being updated was because we were not getting the entry via the ID field, we were searching on two other fields in the object. When we took those two fields and created a composite key, and made it the @Id field, then the time was updated when we retrieved the object.

With partitioned Gemfire regions, any access to a secondary partition does not update the lastAccessedTime of the primary. So this won't do what we want, we'll need to add some code.

Westy
  • 169
  • 2
  • 15