GetAllEntries - returns all keys/values
()
| 86 | |
| 87 | // GetAllEntries - returns all keys/values |
| 88 | func (c *BoltCache) GetAllEntries() (values map[string][]byte, err error) { |
| 89 | err = c.DS.View(func(tx *bolt.Tx) error { |
| 90 | b := tx.Bucket(c.CurrentBucket) |
| 91 | if b == nil { |
| 92 | // bucket doesn't exist |
| 93 | return nil |
| 94 | } |
| 95 | c := b.Cursor() |
| 96 | |
| 97 | values = make(map[string][]byte) |
| 98 | |
| 99 | for k, v := c.First(); k != nil; k, v = c.Next() { |
| 100 | var buffer bytes.Buffer |
| 101 | buffer.Write(v) |
| 102 | values[string(k)] = buffer.Bytes() |
| 103 | } |
| 104 | return nil |
| 105 | }) |
| 106 | return |
| 107 | } |
| 108 | |
| 109 | // RecordsCount - returns records count |
| 110 | func (c *BoltCache) RecordsCount() (count int, err error) { |