Added optional public_key_fn to RedisCache