Optional cache bypass
This commit is contained in:
parent
dc5ab759f2
commit
d79c95f617
5
waycast-core/src/cache/mod.rs
vendored
5
waycast-core/src/cache/mod.rs
vendored
@ -74,6 +74,11 @@ impl Cache {
|
|||||||
where
|
where
|
||||||
T: Serialize + DeserializeOwned + Clone,
|
T: Serialize + DeserializeOwned + Clone,
|
||||||
{
|
{
|
||||||
|
// Check if caching is disabled via environment variable
|
||||||
|
if std::env::var("WAYCAST_NO_CACHE").is_ok() {
|
||||||
|
return Ok(compute());
|
||||||
|
}
|
||||||
|
|
||||||
// Try to get from cache first
|
// Try to get from cache first
|
||||||
if let Some(entry) = self.get_cached_entry::<T>(key)? {
|
if let Some(entry) = self.get_cached_entry::<T>(key)? {
|
||||||
// Check if entry has expired
|
// Check if entry has expired
|
||||||
|
Loading…
x
Reference in New Issue
Block a user