Documentation
¶
Overview ¶
Package console holds the cache commands.
Four of them, each a value with a Handle and a Command that puts it in a console.Registry. They are here and not in the parent package because a command imports the console, the console imports the cache, and a cache that imported its own commands would be a cycle.
Every command that touches entries takes a --tenant and holds a system grant for it. Flush empties one tenant's slice of one namespace, and a cache:clear that emptied the store would clear every other customer on the way past.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheTableCommand ¶
type CacheTableCommand struct {
// Directory is where the migration is written. Empty means the working
// directory's database/migrations, which is where the rest of them live.
Directory string
}
CacheTableCommand writes the migration for the cache tables.
It writes SQL and not a migration type, because there is no migration type to write against yet: hesape/database is being built in parallel and this command belongs to whoever needs the table today. When it lands, this is the file that changes.
func NewCacheTableCommand ¶
func NewCacheTableCommand(directory string) *CacheTableCommand
NewCacheTableCommand returns the command.
func (*CacheTableCommand) Command ¶
func (c *CacheTableCommand) Command() console.Command
Command is the registry entry for make:cache-table.
type ClearCommand ¶
type ClearCommand struct {
// contains filtered or unexported fields
}
ClearCommand flushes one tenant's cache.
The tenant is not optional: Flush empties one tenant's slice of one namespace, and a cache:clear that emptied the store would clear every other customer on the way past. In a SaaS that is an outage caused by a support request.
func NewClearCommand ¶
func NewClearCommand(m *cache.CacheManager) *ClearCommand
NewClearCommand returns the command.
func (*ClearCommand) Command ¶
func (c *ClearCommand) Command() console.Command
Command is the registry entry for cache:clear.
func (*ClearCommand) Handle ¶
Handle runs the command.
It answers ClearCommand::handle(), including the order: the locks branch comes first and does nothing else, because clearing the locks and clearing the cache are different operations and doing both would release a lock somebody is holding on the way to emptying a cache.
type ForgetCommand ¶
type ForgetCommand struct {
// contains filtered or unexported fields
}
ForgetCommand removes one key from the cache.
func NewForgetCommand ¶
func NewForgetCommand(m *cache.CacheManager) *ForgetCommand
NewForgetCommand returns the command.
func (*ForgetCommand) Command ¶
func (c *ForgetCommand) Command() console.Command
Command is the registry entry for cache:forget.
type PruneStaleTagsCommand ¶
type PruneStaleTagsCommand struct {
// contains filtered or unexported fields
}
PruneStaleTagsCommand removes the tag entries nothing points at any more.
It is a no-op on every store this package ships, and says so rather than pretending it did something. A tag generation here is an ordinary entry with a ttl, so it prunes itself; the store that keeps a set beside them, and therefore has something to prune, is the RESP one in hesape/redis, a separate module registered through CacheManager.Extend.
func NewPruneStaleTagsCommand ¶
func NewPruneStaleTagsCommand(m *cache.CacheManager) *PruneStaleTagsCommand
NewPruneStaleTagsCommand returns the command.
func (*PruneStaleTagsCommand) Command ¶
func (c *PruneStaleTagsCommand) Command() console.Command
Command is the registry entry for cache:prune-stale-tags.