mirror of
https://github.com/0xERR0R/blocky.git
synced 2026-10-12 02:01:13 +00:00
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package stringcache
|
|
|
|
type GroupedStringCache interface {
|
|
// Contains checks if one or more groups in the cache contains the search string.
|
|
// Returns a map of matching group -> the rule that matched, or nil/empty when
|
|
// the string was not found.
|
|
//
|
|
// The returned map must be freshly allocated and owned by the caller: callers
|
|
// (e.g. ChainedGroupedCache) may retain and mutate it. Implementations must not
|
|
// return a retained, shared, or pooled map.
|
|
Contains(searchString string, groups []string) map[string]string
|
|
|
|
// Refresh creates new factory for the group to be refreshed.
|
|
// Calling Finish on the factory will perform the group refresh.
|
|
Refresh(group string) GroupFactory
|
|
|
|
// ElementCount returns the amount of elements in the group
|
|
ElementCount(group string) int
|
|
}
|
|
|
|
type GroupFactory interface {
|
|
// AddEntry adds a new string to the factory to be added later to the cache groups.
|
|
AddEntry(entry string) bool
|
|
|
|
// Count returns amount of processed string in the factory
|
|
Count() int
|
|
|
|
// Finish replaces the group in cache with factory's content
|
|
Finish()
|
|
}
|