valuesNull is always false in a cache

I am creating a cache using the management API and no matter what I specify, the valuesNull field is always false.

This is the response when I created the cache :

{
  "description" : "testcache",
  "diskSizeInMB" : 0,
  "distributed" : true,
  "expirySettings" : {
    "timeoutInSec" : {
      "value" : "604800"
    },
    "valuesNull" : false
  },
  "inMemorySizeInKB" : 0,
  "maxElementsInMemory" : 0,
  "maxElementsOnDisk" : 0,
  "name" : "testcache",
  "overflowToDisk" : false,
  "persistent" : false
}

The cachetest.json file contains the below data:

{
  "description" : "testcache", 
  "expirySettings" : { 
    "timeoutInSec" : { 
      "value" : "604800" 
    }, 
    "valuesNull" : true 
  },
  "name" : "testcache"
}

Initially there was some confusion as to whether the valuesNull field was a boolean or a string (the Management API page shows the value as "false" - with double quotes). I tried sending it as both string and boolean and got the same response.

I also tried to update the Cache using the management api with valuesNull as 'true' and got the same response.

0 4 212
4 REPLIES 4

Hi

I understand your confusion.

Looking into it, I don't see any documentation for the valuesNull field .

Is the behavior of the cache when valuesNull is true.... not meeting your expectations?

Or maybe you are simply reporting that this part of the Admin API is confusing.

Maybe you could clarify that for me.

I've raised a bug for this confusing behavior. b/110832718

The valuesNull property is meaningless. You can ignore it.

Is the behavior of the cache when valuesNull is true.... not meeting your expectations?

Or maybe you are simply reporting that this part of the Admin API is confusing.

My issue is that no matter what I do, I can never create a cache with valuesNull as true - which is what I was looking to do since having a centralised point from where one can update the cache expiry seemed a good approach - instead of going to 10 API Proxies where that cache is used, find the PopulateCache in each of them and update the expiry time in each one of them.

That said, it doesn't help that the documentation is sparse and does not do a good job at at explaining valuesNull.

valuesNull is erroneously exposed as a property. It's not documented, because it should not have been exposed. It has no meaning to you. It is not something you can set, and its value is not important to you. You should ignore it.

Regarding: "update the cache expiry". The expiry of a cached element is set at the time the element is inserted into cache. You cannot "update the expiry" of an element once it is placed into cache.

Maybe you mean you would like to modify the cache expiry setting in the configuration of the policy. It sounds like you have 5 or 7 policies and you want to do it in one place. If so, I have two suggestions for you.

  1. Extract all the identical cache polices into a shared flow. Call into the shared flow from the various proxies. If you want to update the caching configuration, modify the ONE policy in the shared flow.
  2. In a production environment, All your policies should be deployed via an automated process; some people use the term "continuous deployment" to describe this. (this is the CD in CI/CD). If you follow this approach, then the configuration for caching gets updated once, in your code repo. And then any policies that use the configuration (even if there are 7 policies, or 17 policies, or whatever) will all share the common configuration. Deployment of these proxies is then automated. It should not matter that you have 7 proxies or 17, they all get deployed anyway, and the effort is the same.

Helpful ?