"ERR unknown command 'memory', with args beginning with: USAGE" with Jedis and AWS ElastiCache

0

While using memoryUsage(key) method of Jedis i am getting this following error "errorMessage": "ERR unknown command 'memory', with args beginning with: USAGE" is it possible that this method is not allowed on AWS ElastiCache

Note: My ElastiCache instance is encrypted and i have ssl set as true.

Expected behavior: I should retrieve the memory used by key-value in cache

Actual behavior getting this error : "ERR unknown command 'memory', with args beginning with: USAGE"

Steps to reproduce: use Jedis client library and using Jedispool get a jedis connection and try to use this method on your ElastiCache instance

public Long getValueSize(String hashKey, Jedis jedis) {
  log.info("Request received to get memory usage from redis for key {}", hashKey);
  byte[] serializeKey = kryo.serialize(hashKey);
  return jedis.memoryUsage(serializeKey);
}

i am using JedisPool from which i am taking a Jedis instance to perform this action.

Redis / Jedis Configuration Jedis library version: 5.1.2 ElastiCache version: 7.1.0 Java version: 17

When i tried it locally with dockerized environment, where my java client was running as a lambda inside a docker container and redis instance was also running in a container at that time i am not getting such error and obtaining the expected result and on aws environment where i have ElastiCache instead of Redis i am getting this error as a response.

I believe it might be case that this particular method is not compatible with AWS ElastiCache but i am not sure of it as i am using it first time.

Thanks in advance :)

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions