Struct forceps::Metadata[][src]

pub struct Metadata { /* fields omitted */ }

Metadata information about a certain entry in the cache

This metadata contains information about when the entry was last modified, the size (in bytes) of the entry, the md5 integrity of the entry, etc.

Examples

use forceps::Cache;

let cache = Cache::new("./cache")
    .build()
    .await
    .unwrap();

cache.write(&b"MY_KEY", &b"Hello World").await.unwrap();

let metadata = cache.read_metadata(&b"MY_KEY").unwrap();

Implementations

impl Metadata[src]

pub fn get_size(&self) -> u64[src]

The size in bytes of the corresponding cache entry.

pub fn get_last_modified(&self) -> Option<SystemTime>[src]

Retrives the last time this entry was modified.

pub fn get_last_modified_raw(&self) -> u64[src]

Retrieves the raw last_modified time, which is the milliseconds since time::UNIX_EPOCH. If the returned result is 0, that means there is no last_modified time.

pub fn get_hits(&self) -> u64[src]

The total number of times this entry has been read.

NOTE: This will be 0 unless track_access is enabled from the CacheBuilder

pub fn get_last_acccessed(&self) -> Option<SystemTime>[src]

Retrives the last time this entry was accessed (read from).

NOTE: This will be the same as get_last_modified unless track_access is enabled from the CacheBuilder

pub fn get_last_accessed_raw(&self) -> u64[src]

Retrieves the raw last_accessed time, which is the milliseconds since time::UNIX_EPOCH. If the returned result is 0, that means there is no last_accessed time.

NOTE: This will be the same as get_last_modified_raw unless track_access is enabled from the CacheBuilder

pub fn get_integrity(&self) -> &Md5Bytes[src]

Retrieves the internal Md5Bytes integrity of the corresponding metadata entry.

pub fn check_integrity_of(&self, data: &[u8]) -> bool[src]

Verifies that the metadata integrity matches the integrity of the data provided.

Trait Implementations

impl Debug for Metadata[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for Metadata[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Metadata[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]