Documentation ¶
Index ¶
- Constants
- type Bucket
- type Entry
- type HashTable
- func (ht *HashTable) Exist(k string) bool
- func (ht *HashTable) Flush()
- func (ht *HashTable) Get(k string) string
- func (ht *HashTable) Iter() <-chan *Entry
- func (ht *HashTable) Remove(k string) int
- func (ht *HashTable) Set(k string, v string)
- func (ht *HashTable) SetEX(k string, v string, expiresAfter int)
- func (ht *HashTable) Size() int
Constants ¶
View Source
const (
// DefaultSize is the default size of the table
DefaultSize = 16
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct { Key string Value string CreatedAt time.Time ShouldExpire bool ExpireAfter int Next *Entry }
Entry represents an entry inside the bucket
type HashTable ¶
type HashTable struct {
// contains filtered or unexported fields
}
HashTable data structure
func (*HashTable) Exist ¶
Exist returns true if an item with the given key exists otherwise returns false
func (*HashTable) Get ¶
Get returns the value of the given key if the result is empty then returns an empty string ("")
Click to show internal directories.
Click to hide internal directories.