pub trait CachePolicy {
type Transformer: Transformer;
type CacheId: Ord + Hash + Sized + Clone + Send + Sync + Debug + 'static;
type CacheLoader: CacheLoader<Self::Transformer>;
const QUERY_DATABASE: bool;
const QUERY_DATABASE_IF_NOT_FULL: bool;
const LOAD_DATABASE: bool;
const LOAD_MOST_RECENT_FIRST: bool;
const SIZE: usize;
const MAX_SIZE: usize;
}Expand description
Defines how caching of entities and events is handled
Required Associated Constants§
Sourceconst QUERY_DATABASE: bool
const QUERY_DATABASE: bool
Indicates whether the database should be queried on a cache miss
Sourceconst QUERY_DATABASE_IF_NOT_FULL: bool
const QUERY_DATABASE_IF_NOT_FULL: bool
Indicates whether the database should be queried on a cache miss if the size of the cache is less than SIZE
Only has an effect if QUERY_DATABASE is true
Sourceconst LOAD_DATABASE: bool
const LOAD_DATABASE: bool
Indicates whether the database should be queried to load the cache initially
Sourceconst LOAD_MOST_RECENT_FIRST: bool
const LOAD_MOST_RECENT_FIRST: bool
Whether or not to load most recent values from the database first
Required Associated Types§
Sourcetype Transformer: Transformer
type Transformer: Transformer
Related Transformer
Sourcetype CacheId: Ord + Hash + Sized + Clone + Send + Sync + Debug + 'static
type CacheId: Ord + Hash + Sized + Clone + Send + Sync + Debug + 'static
The type of key used when looking up the cache. This will be the same as the id field if using a default policy
Sourcetype CacheLoader: CacheLoader<Self::Transformer>
type CacheLoader: CacheLoader<Self::Transformer>
Struct to use for loading the cache. This could have a custom implementation to only load the rows required from the database
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.