lrustate

package module
v0.0.0-...-9584331 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2020 License: ISC Imports: 4 Imported by: 0

README

lrustate

An LRU/LFU (Least Recently Used/Least Frequently Used) cache for Arikawa, the Discord library.

Documentation

Overview

Package lrustate implements a state storage with LRU capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelStore

type ChannelStore struct {
	// contains filtered or unexported fields
}

func (*ChannelStore) Channel

func (s *ChannelStore) Channel(id discord.Snowflake) (*discord.Channel, error)

func (*ChannelStore) ChannelRemove

func (s *ChannelStore) ChannelRemove(ch *discord.Channel) error

func (*ChannelStore) ChannelSet

func (s *ChannelStore) ChannelSet(ch *discord.Channel) error

func (*ChannelStore) Channels

func (s *ChannelStore) Channels(guildID discord.Snowflake) ([]discord.Channel, error)

func (*ChannelStore) CreatePrivateChannel

func (s *ChannelStore) CreatePrivateChannel(user discord.Snowflake) (*discord.Channel, error)

func (*ChannelStore) PrivateChannels

func (s *ChannelStore) PrivateChannels() ([]discord.Channel, error)

func (*ChannelStore) Reset

func (s *ChannelStore) Reset()

type GuildStore

type GuildStore struct {
	// contains filtered or unexported fields
}

func (*GuildStore) Guild

func (s *GuildStore) Guild(id discord.Snowflake) (*discord.Guild, error)

func (*GuildStore) GuildRemove

func (s *GuildStore) GuildRemove(id discord.Snowflake) error

func (*GuildStore) GuildSet

func (s *GuildStore) GuildSet(g *discord.Guild) error

func (*GuildStore) Guilds

func (s *GuildStore) Guilds() ([]discord.Guild, error)

func (*GuildStore) Reset

func (s *GuildStore) Reset()

type Store

type Store struct {
	GuildStore
	ChannelStore
}

Store implements the state storage using a special LRU cache. This store pertains all IDs, but purges structs as usual.

In some cases, functions that return a single struct would be a cache-hit, but functions that return a slice would be a cache-miss. This is to prevent incomplete slices.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL