How can I disable the default cache adapter via an env var?

#1

Hello community!

We’ve been running parse server in production for 5 years, most recently 2.8.2 on NodeChef. I’ve been profiling our memory use, and to help with this I’d like to disable the default cache adapter, which is InMemoryCacheAdapter judging from the source code. I can see that there’s also NullCacheAdapter, which sounds like it may do the job.

I’ve been trying to set the PARSE_SERVER_CACHE_ADAPTER env var to use the NullCacheAdapter instead. I’ve tried setting it to “NullCacheAdapter” and “./Cache/NullCacheAdapter”, but neither of these seems to work (I can’t be sure, but our memory profile doesn’t change, and I would have expected better). So my questions are:

  1. What is the correct format to change the cache adapter via the environment variable?
  2. What is the best way of testing that a particular cache adapter is being used?

Because we’re using Parse-as-a-service, it’s obviously not possible for me to manually start the server or do very much.

Thanks in advance!

#2

“./Cache/NullCacheAdapter” should work (and you should see an error in your logs in the case the path is not right). But I think that ENV vars are only available when Parse Server is started through CLI and I’m not sure that NodeCheck starts like this. Otherwise you will have to send cacheAdapter option when initializing a new ParseServer(). Anyway, the solution really depends on how they run the Parse Server, so I think you should figure it out with them.

#3

Ahh, OK, good to know I’m not crazy. NodeChef allows env vars to be set, and parse server correctly uses other ones. Just a bit puzzled why that particular one doesn’t work for me. Will follow up with them :+1: