"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 :)

patrick
已提問 2 個月前檢視次數 152 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南