Comments (2)
You can use the type
, create
, and convert
options to get what you're looking for (also result = true
to cache only Ok
results):
#[cached(
result = true,
type = "TimedCache<uuid::Uuid, String>",
create = "{ TimedCache::with_lifespan(600) }",
convert = r#"{ user_id.clone() }"#
)]
pub fn get_user(conn: &PgConnection, user_id: &uuid::Uuid) -> MyResult<User> {
...
Ok(user)
}
from cached.
Wow, thanks.
It is more complex than I thought.
from cached.
Related Issues (20)
- Also generate the fresh data function HOT 2
- Cannot call *_no_cache function HOT 3
- `failed to resolve: could not find `async_sync` in `cached`` HOT 2
- Once with sync_writes and async causes deadlocks in tokio.
- Unnecessary `&mut V` with `get_or_set_with` and `try_get_or_set_with` (CachedAsync)
- Feature: Ability to configure (or reconfigure) a SizedCache `size` based on runtime data HOT 4
- 2021 edition?
- Async disk cache HOT 4
- Add helper attribute to ignore arguments HOT 1
- Disk Cache does not persist between runs HOT 1
- Borrowed keys and values for `IOCached::set_cache` HOT 1
- Cache clear operation
- proc_macro: support args which are &T and Option<&T>
- [Question] Thread safety? HOT 3
- Redis cache doesn't support patterns HOT 1
- DiskCache blobs aren't cleaned on overwrite HOT 1
- Why does `DiskCache` need to impl `Display`? HOT 6
- [Discussion] What do you think of removing `async-std` support?
- Cache hit / miss rate metrics when using `cached` procedural macro HOT 2
- Generic parameters not added to no_cache function.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cached.