1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-23 23:51:06 +01:00

removed map combinators

This commit is contained in:
dowwie 2019-12-18 15:07:47 -05:00
parent 512fe9c0e0
commit 2d6ff41563

View File

@ -221,8 +221,8 @@ impl Inner {
let value = cookie.value().to_owned();
let cachekey = (self.cache_keygen)(&cookie.value());
return
self.addr.send(Command(resp_array!["GET", cachekey])).map(
|result| match result {
match self.addr.send(Command(resp_array!["GET", cachekey]))
.await {
Err(e) => Err(Error::from(e)),
Ok(res) => match res {
Ok(val) => {
@ -256,9 +256,7 @@ impl Inner {
Err(error::ErrorInternalServerError(err))
}
},
},
)
.await;
}
} else {
return Ok(None)
}
@ -312,10 +310,10 @@ impl Inner {
let state: HashMap<_, _> = state.collect();
match serde_json::to_string(&state) {
Err(e) => Err(e.into()),
Ok(body) =>
self.addr
Ok(body) => {
match self.addr
.send(Command(resp_array!["SET", cachekey, body, "EX", &self.ttl]))
.map(|result| match result {
.await {
Err(e) => Err(Error::from(e)),
Ok(redis_result) => match redis_result {
Ok(_) => {
@ -331,8 +329,8 @@ impl Inner {
}
Err(err) => Err(error::ErrorInternalServerError(err)),
},
})
.await,
}
}
}
}
@ -340,9 +338,9 @@ impl Inner {
async fn clear_cache(&self, key: String) -> Result<(), Error> {
let cachekey = (self.cache_keygen)(&key);
self.addr
match self.addr
.send(Command(resp_array!["DEL", cachekey]))
.map(|res| match res {
.await {
Err(e) => Err(Error::from(e)),
Ok(res) => {
match res {
@ -353,8 +351,7 @@ impl Inner {
)),
}
}
})
.await
}
}
/// invalidates session cookie