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