Populate Cache Expiry Time is not getting set correctly

Not applicable

I am trying to populate some entries in cache , I have used ref variable for setting the <Timeout in Sec> tag.

Please see my policy details below:

<PopulateCache name="PopulateCacheForXYZ"> 
  <DisplayName>PopulateCacheForUSSA</DisplayName> 
  <FaultRules/> 
  <Properties/> 
  <CacheKey> 
    <Prefix/> 
    <KeyFragment ref="XYZcode"/> 
  </CacheKey> 
  <CacheResource>test-cache</CacheResource> 
  <Scope>Global</Scope> 
  <ExpirySettings> 
    <TimeoutInSec ref="expirytime_for_cache">7200</TimeoutInSec> 
  </ExpirySettings> 
  <Source>access_token</Source> 
</PopulateCache>

So I am fetching "expirytime_for_cache" from KVM , The KVM value is being retrieved correctly , but the Cache Population never exceeding 2 Hours.

Can you please help with the issue?

2 12 1,663
12 REPLIES 12

Not applicable

Can you copy the contents of <CacheResource>test-cache</CacheResource> ?

You can get that using the management API

https://api.enterprise.apigee.com/v1/organizations/{org_name}/environments/{env_name}/caches

Not applicable

@Maruti Chand Please find the response of the management API call:

{
  "compression": {
    "minimumSizeInKB": 2048
  },
  "description": "",
  "diskSizeInMB": 0,
  "distributed": true,
  "expirySettings": {
    "timeoutInSec": {
      "value": "36000"
    },
    "valuesNull": false
  },
  "inMemorySizeInKB": 2048,
  "maxElementsInMemory": 1000,
  "maxElementsOnDisk": 1000,
  "name": "test-cache",
  "overflowToDisk": true,
  "persistent": false,
  "skipCacheIfElementSizeInKBExceeds": 1024
}

Ref attribute in TimeoutInSec works - I don't think this is your problem if you are setting the variable value correctly.

In your cache properties, I am seeing "inMemorySizeInKB": 2048. Is it possible that you are hitting this upper bound when you are caching new data in? Apigee cache works in LRU eviction algorithm.

You are also setting compression minimumSizeInKB to 2048 (same value as inMemorySizeInKB) - are you sure this is correct?

It might make sense to create a new cache resource leaving default values in for those parameters and retrying with lower TTL values.

Not applicable

Hi @akshay_anand , As per your explanation I understand that there is no problem with caching the elements but its with the expiry settings .

Looks like 'expirytime_for_cache' is not being set correctly as I can think of this happening only in that case . If you are on on-perm you can enable debug logs and check whats happening or pls download the trace and copy here .

What you have done here works for me. I suggest that you double check that you have the context variable set properly. You can use the Trace window to do so.

The issue was resolved , the fix was simple if I am specifying the value in TimeoutInSec along with ref value

<TimeOutInSec ref= "timeout">7200</TimeOutInSec>

It always picks the value and doesn't consider ref value , even if ref value is coming , so I just removed the value 7200 and it started working.

Old post, but I was having same issue if I use both the ref and the value, only the value is used.

This behaves differently than the Interval on Quota which treats the literal as a default.

Is this issue resolved? Even form me ref value is not used when I specify some value in TimeoutInSec.

I don't believe it's resolved, in fact I don't know of a bug in the backlog covering this behavior. For now you'll have to workaround the problem.

I've just created a bug for this behavior. b/143612992

It's in the backlog.

Hello all - We are seeing the same issue on our instance of Apigee. I was curious if this bug was already resolved or if this fix is in progress?

This fix is first available in OPDK 4.50.00

Also fixed in cloud.

I'm facing this issue now. Just curious to know if it is resolved.