Cache

Struct Cache 

Source
pub struct Cache { /* private fields */ }

Implementations§

Source§

impl Cache

Source

pub fn new(config: CacheConfig) -> Arc<Self>

Source§

impl Cache

Source

pub async fn get_user(&self, id: UserId) -> Option<User>

Source

pub async fn get_user_data<F, T>(&self, id: UserId, f: F) -> Option<T>
where F: FnOnce(&User) -> T,

Source

pub async fn commit_user(&self, v: &User)

Source§

impl Cache

Source

pub async fn patch_user( &self, user_id: UserId, patch: impl FnOnce() -> UserPatch, remove: Option<UserField>, )

Source

pub async fn get_users_aggregate<T, F>(&self, f: F) -> T
where F: FnOnce(UserIter<'_>) -> T,

Source§

impl Cache

Source

pub async fn get_server(&self, id: ServerId) -> Option<Server>

Source

pub async fn get_server_data<F, T>(&self, id: ServerId, f: F) -> Option<T>
where F: FnOnce(&Server) -> T,

Source

pub async fn commit_server(&self, v: &Server)

Source§

impl Cache

Source

pub async fn patch_server( &self, server_id: ServerId, patch: impl FnOnce() -> PartialServer, remove: Option<ServerField>, )

Source

pub async fn delete_server(&self, server_id: ServerId)

Source

pub async fn get_servers_aggregate<T, F>(&self, f: F) -> T
where F: FnOnce(ServerIter<'_>) -> T,

Source§

impl Cache

Source

pub async fn get_server_of_role(&self, id: RoleId) -> Option<ServerId>

Source

pub async fn patch_role( &self, server_id: ServerId, role_id: RoleId, patch: impl FnOnce() -> PartialRole, remove: Option<RoleField>, )

Source

pub async fn delete_role(&self, id: ServerId, role: RoleId)

Source§

impl Cache

Source

pub async fn get_member(&self, id: MemberId) -> Option<Member>

Source

pub async fn get_member_data<F, T>(&self, id: MemberId, f: F) -> Option<T>
where F: FnOnce(&Member) -> T,

Source

pub async fn commit_member(&self, v: &Member)

Source§

impl Cache

Source

pub async fn patch_member( &self, member_id: MemberId, patch: impl FnOnce() -> PartialMember, remove: Option<MemberField>, )

Source

pub async fn get_members_aggregate<T, F>(&self, f: F) -> T
where F: FnOnce(MemberIter<'_>) -> T,

Source§

impl Cache

Source

pub async fn get_channel(&self, id: ChannelId) -> Option<Channel>

Source

pub async fn get_channel_data<F, T>(&self, id: ChannelId, f: F) -> Option<T>
where F: FnOnce(&Channel) -> T,

Source§

impl Cache

Source

pub async fn commit_channel(&self, channel: &Channel)

Source

pub async fn patch_channel( &self, channel_id: ChannelId, patch: impl FnOnce() -> PartialChannel, remove: Option<ChannelField>, )

Source

pub async fn delete_channel(&self, channel_id: ChannelId)

Source

pub async fn get_channels_aggregate<T, F>(&self, f: F) -> T
where F: FnOnce(ChannelIter<'_>) -> T,

Source§

impl Cache

Source

pub async fn get_message( &self, channel: ChannelId, message: MessageId, ) -> Option<Message>

Source

pub async fn get_message_data<F, T>( &self, channel: ChannelId, message: MessageId, f: F, ) -> Option<T>
where F: FnOnce(&Message) -> T,

Source

pub async fn commit_message(&self, message: &Message)

Source

pub async fn patch_message( &self, channel_id: ChannelId, message_id: MessageId, patch: impl FnOnce() -> PartialMessage, )

Source

pub async fn get_messages_aggregate<T, F>( &self, channel_id: ChannelId, f: F, ) -> Option<T>
where F: FnOnce(MessageIter<'_>) -> T,

Trait Implementations§

Auto Trait Implementations§

§

impl !Freeze for Cache

§

impl !RefUnwindSafe for Cache

§

impl Send for Cache

§

impl Sync for Cache

§

impl Unpin for Cache

§

impl !UnwindSafe for Cache

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V