1
0
mirror of https://github.com/astaxie/beego.git synced 2025-02-23 06:37:12 +00:00

21 lines
341 B
Go
Raw Normal View History

2018-11-09 12:37:28 +08:00
// +build leveldb
package leveldb
// #cgo LDFLAGS: -lleveldb
// #include <stdint.h>
// #include "leveldb/c.h"
import "C"
type Cache struct {
Cache *C.leveldb_cache_t
}
func NewLRUCache(capacity int) *Cache {
return &Cache{C.leveldb_cache_create_lru(C.size_t(capacity))}
}
func (c *Cache) Close() {
C.leveldb_cache_destroy(c.Cache)
}