Use $_ENV in the new Cache Time setting

I’m trying to use environment variable with the new redis cache feature on api action.

I have a simple action that return a database query with multiple records and I want to cache this. When I put 10 in the ‘Cache Time’ setting and call the api the cache is working and during 10 seconds the api return from the cache.

If I want to move this value (10) to docker compose environment section to handle different cache time between dev / staging / production and use $_ENV in the api setting like this:

app/api/translations.json:

{
  "settings": {
    "options": {
      "ttl": "{{$_ENV.TRANSLATIONS_CACHE_TIME.toNumber()}}"
    }
  },
  ...
}

No error is shown but the cache feature doesn’t work after that, any idea ?

Community Page
Last updated: