pub trait CredentialsCache {
// Required methods
fn clear(&mut self) -> Result<(), CredentialsCacheError>;
fn get(
&self,
key: &u64,
) -> Result<Option<&AuthCredentialWithPniResponse>, CredentialsCacheError>;
fn write(
&mut self,
map: HashMap<u64, AuthCredentialWithPniResponse>,
) -> Result<(), CredentialsCacheError>;
}
Expand description
Global cache for groups v2 credentials, as demonstrated in the libsignal-service java library of Signal-Android.
A basic in-memory implementation is provided with InMemoryCredentialsCache
.
Required Methods§
fn clear(&mut self) -> Result<(), CredentialsCacheError>
Sourcefn get(
&self,
key: &u64,
) -> Result<Option<&AuthCredentialWithPniResponse>, CredentialsCacheError>
fn get( &self, key: &u64, ) -> Result<Option<&AuthCredentialWithPniResponse>, CredentialsCacheError>
Get an entry of the cache, key usually represents the day number since EPOCH.
Sourcefn write(
&mut self,
map: HashMap<u64, AuthCredentialWithPniResponse>,
) -> Result<(), CredentialsCacheError>
fn write( &mut self, map: HashMap<u64, AuthCredentialWithPniResponse>, ) -> Result<(), CredentialsCacheError>
Overwrite the entire contents of the cache with new data.