Documentation ¶
Index ¶
Constants ¶
const RedisTemplateChannel = "redis-template-channel"
RedisTemplateChannel is the default channel in which redis-template will notify/listen that changes have been made upon. Redis doesn't have a watch mechanism we decided to not use polling to implement the redis template, and instead rely upon redis's pub sub feature.
Variables ¶
This section is empty.
Functions ¶
func Listen ¶
Listen listens to the redis pubsub channel and when it detects any changes it will rerun all of its templates. If the results of the templates have changed then the new templated results is written to disk and the templates action is performed. If the template target is nil then the results are not persisted to disk.
Types ¶
type Config ¶
type Config struct { Logger *log.Logger Pool *redis.Pool Templates []Template Splay time.Duration Channel string }
Config is the configuration that redis-template uses to perform its templating operations.
type Template ¶
Template is a processed version of a TemplateFlag. Instead of having a path to a source, it has the contents of the source. Otherwise it is the same as a TemplateFlag.
type TemplateFlag ¶
TemplateFlag denotes a templating action to perform. It has a source, the template to process. A target, the file to write to. And an action, a command to execute once the template has been updated.
func ParseTemplateFlag ¶
func ParseTemplateFlag(input string) (TemplateFlag, error)
ParseTemplateFlag parses Templates from strings.
func (TemplateFlag) String ¶
func (t TemplateFlag) String() string
String prints the original source of the template flag.
func (TemplateFlag) ToTemplate ¶
func (t TemplateFlag) ToTemplate(p *redis.Pool) (Template, error)
ToTemplate creates a Template from the given redis pool.
type TemplateFlags ¶
type TemplateFlags []TemplateFlag
TemplateFlags is a
func (*TemplateFlags) Set ¶
func (t *TemplateFlags) Set(value string) error
Set implements the flag.Value interface's Set function. It takes a string from the cli arg and has it parsed.
func (*TemplateFlags) String ¶
func (t *TemplateFlags) String() string
String implements flag.Value interface's String function. It is a pretty print form of the flags