redis / jedis

Redis Java client
MIT License
11.85k stars 3.87k forks source link

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

Closed pratik-patil-polestar closed 7 months ago

pratik-patil-polestar commented 7 months ago

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

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:

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);
  }

and i am using JedisPool from which i am taking a Jedis instance.

Redis / Jedis Configuration

Jedis version: 5.1.2

ElastiCache version: 7.1.0

Java version: 17

sazzad16 commented 7 months ago

is it possible that this method is not allowed on AWS ElastiCache

@pratik-patil-polestar ask AWS ElastiCache.

thank you for using Jedis