You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+89-2Lines changed: 89 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,10 +55,49 @@ func main() {
55
55
}
56
56
```
57
57
58
-
## PubSub Usage (Canonical Example)
58
+
## PubSub Usage
59
59
60
60
MemoryStore supports an agnostic PubSub interface. By default, it uses an in-memory implementation. To use Google Cloud PubSub, simply provide your Project ID configuration.
// The background cleanup routine will automatically remove expired items
221
+
// You can also manually check if an item exists
222
+
time.Sleep(6 * time.Second)
223
+
if_, exists:= store.Get("temp"); !exists {
224
+
log.Println("Key has expired")
225
+
}
226
+
```
227
+
228
+
### Proper Shutdown
229
+
230
+
Always ensure proper cleanup by calling `Stop()`:
231
+
232
+
```go
233
+
store:= memorystore.NewMemoryStore()
234
+
deferfunc() {
235
+
iferr:= store.Stop(); err != nil {
236
+
log.Printf("Error stopping store: %v", err)
237
+
}
238
+
}()
239
+
```
240
+
173
241
## Performance Considerations
174
242
175
243
- Uses `github.com/goccy/go-json` for faster JSON operations
@@ -194,8 +262,27 @@ make bench
194
262
195
263
## Contributing
196
264
197
-
Contributions are welcome! Please feel free to submit a Pull Request.
265
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
266
+
267
+
1. Fork the repository
268
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
269
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
270
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
271
+
5. Open a Pull Request
198
272
199
273
## License
200
274
201
275
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
276
+
277
+
## Acknowledgments
278
+
279
+
- Thanks to the Go team for the amazing standard library
280
+
-[go-json](https://github.com/goccy/go-json) for high-performance JSON operations
281
+
282
+
## Support
283
+
284
+
If you have any questions or need help integrating MemoryStore, please:
285
+
286
+
1. Check the [documentation](https://godoc.org/github.com/BryceWayne/MemoryStore)
0 commit comments