https://github.com/jamesponddotco/recache-go
[READ-ONLY] Simple caching interface for Go's regular expressions package.
https://github.com/jamesponddotco/recache-go
cache caching go lru mockingjay regex regexp
Last synced: 8 months ago
JSON representation
[READ-ONLY] Simple caching interface for Go's regular expressions package.
- Host: GitHub
- URL: https://github.com/jamesponddotco/recache-go
- Owner: jamesponddotco
- License: mit
- Created: 2023-03-30T22:19:13.000Z (about 3 years ago)
- Default Branch: trunk
- Last Pushed: 2023-04-12T16:22:53.000Z (about 3 years ago)
- Last Synced: 2025-10-27T15:49:26.350Z (8 months ago)
- Topics: cache, caching, go, lru, mockingjay, regex, regexp
- Language: Go
- Homepage: https://sr.ht/~jamesponddotco/recache-go/
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# recache
[](https://godocs.io/git.sr.ht/~jamesponddotco/recache-go)
[](https://goreportcard.com/report/git.sr.ht/~jamesponddotco/recache-go)
> **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](https://godocs.io/regexp) that offers improved performance
by avoiding recompilation of global regular expression variables and by caching
regular expressions.
## Features
- Stable cache interface.
- Simple and easy-to-use API.
- Thread-safe caching of compiled regular expressions.
- Lazy compilation of regular expressions.
- Minimal memory allocations.
### `recache.Cache` implementations
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`](https://git.sr.ht/~jamesponddotco/recache-go/tree/trunk/item/lrure)
provides a thread-safe in-memory cache using the [least recently used
(LRU)](https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU))
cache replacement policy.
- [`mockingjayre`](https://git.sr.ht/~jamesponddotco/recache-go/tree/trunk/item/mockingjayre)
provides an in-memory cache using the
[Mockingjay](https://en.wikipedia.org/wiki/Cache_replacement_policies#Mockingjay)
cache replacement policy.
If wrote a `recache.Cache` implementation and wish it to be linked here,
[please send a patch](https://git.sr.ht/~jamesponddotco/recache-go#resources).
## Installation
To install `recache` alone, run:
```sh
go get git.sr.ht/~jamesponddotco/recache-go
```
## Contributing
Anyone can help make recache better. Check out [the contribution
guidelines](https://git.sr.ht/~jamesponddotco/recache-go/tree/master/item/CONTRIBUTING.md)
for more information.
## Resources
The following resources are available:
- [Package documentation](https://godocs.io/git.sr.ht/~jamesponddotco/recache-go).
- [Support and general discussions](https://lists.sr.ht/~jamesponddotco/recache-discuss).
- [Patches and development related questions](https://lists.sr.ht/~jamesponddotco/recache-devel).
- [Instructions on how to prepare patches](https://git-send-email.io/).
- [Feature requests and bug reports](https://todo.sr.ht/~jamesponddotco/recache).
---
Released under the [MIT License](LICENSE.md).