go-dfl: github.com/spatialcurrent/go-dfl/pkg/dfl/cache Index | Files

package cache

import "github.com/spatialcurrent/go-dfl/pkg/dfl/cache"


Package Files


type Cache Uses

type Cache struct {
    // contains filtered or unexported fields

Cache is a struct that stores the compiled nodes to prevent expensive parsing and compiling of DFL expressions.

func New Uses

func New() *Cache

NewCache returns a new node cache

func (*Cache) Get Uses

func (c *Cache) Get(exp string) (dfl.Node, bool)

Get returns the node for the given expression and true, if a valid node is found. Otherwise, Get returns (nil, false).

func (*Cache) Has Uses

func (c *Cache) Has(exp string) bool

Has returns true if the cache has the Node for the given expression in the cache.

func (*Cache) MustParseCompile Uses

func (c *Cache) MustParseCompile(exp string) dfl.Node

MustParseCompile parses and compiles the expression and then sets the resulting node in the cache.

func (*Cache) ParseCompile Uses

func (c *Cache) ParseCompile(exp string) (dfl.Node, error)

Parse and compile the DFL expression. If the expression was already compiled, use the version found in the cache. Otherwise,

func (*Cache) Set Uses

func (c *Cache) Set(exp string, node dfl.Node)

Set adds the given node to the cache with the expression as key.

Package cache imports 3 packages (graph) and is imported by 1 packages. Updated 2019-09-22. Refresh now. Tools for package owners.