using lazy_static I do this
static ref CLIENT: Box<Pool<MemcacheConnectionManager>> = Box::new(
block_on(MemcacheClient::init(CoreConfig::init(
"config/app/config.yaml",
)))
.client
.unwrap()
);
static ref CONN: RwLock<PooledConnection<'static, MemcacheConnectionManager>> =
RwLock::new(*Box::new(block_on((unsafe { CLIENT }).get()).unwrap()));
and eventually try to do this:
CONN.read()
.await
.borrow_mut()
.get_multi(&cache_keys_ref)
I'm getting the following error:
cannot borrow data in dereference of tokio::sync::RwLockReadGuard<'_, PooledConnection<'_, MemcacheConnectionManager>>
as mutable
trait DerefMut
is required to modify through a dereference, but it is not implemented for tokio::sync::RwLockReadGuard<'_, PooledConnection<'_, MemcacheConnectionManager>>
rustcE0596
I have searched a lot of approaches but in rust such pattern is not allowed. I wish to proceed with such approach where we keep the connection open for better latency numbers. At the moment only memcache-async (ascii) is viable but facing the connection issue. Any help would be appreciated.