github.com/l3x/golibs

golibs


License
Unlicense
Install
go get github.com/l3x/golibs

Documentation

Build Status Code Coverage Go Report Card GolangCI Go Doc

golibs

This repository contains several useful functions and interfaces for Go:

  • Cache - in-memory cache with LRU, limits and statistics
  • Log - logger with configurable log-level on top of standard "log"
  • File:
    • safe file writing
  • JSON:
    • JSON format helper functions
  • Utils:
    • hostname validator

Cache

A quick example:

conf := cache.Config{}
conf.EnableLRU = true
c := cache.New(conf)
c.Set([]byte("key"), []byte("value"))
val := c.Get([]byte("key"))