Note: This library is under active development and most pieces haven't been tested yet. Do not use in production until a tagged v2.0.0 release is out.
Package recache
is a lightweight caching library for Go's standard regular
expression package that offers improved performance
by avoiding recompilation of global regular expression variables and by caching
regular expressions.
- Stable cache interface.
- Simple and easy-to-use API.
- Thread-safe caching of compiled regular expressions.
- Lazy compilation of regular expressions.
- Minimal memory allocations.
The recache
package itself only provides a cache interface and some utility
functions for users who wish to implement that interface. You can either use an
implementation created by someone else or write your own.
Implementations
lrure
provides a thread-safe in-memory cache using the least recently used (LRU) cache replacement policy.mockingjayre
provides an in-memory cache using the Mockingjay cache replacement policy.
If wrote a recache.Cache
implementation and wish it to be linked here,
please send a patch.
To install recache
alone, run:
go get git.sr.ht/~jamesponddotco/recache-go
Anyone can help make recache better. Check out the contribution guidelines for more information.
The following resources are available:
- Package documentation.
- Support and general discussions.
- Patches and development related questions.
- Instructions on how to prepare patches.
- Feature requests and bug reports.
Released under the MIT License.