Important note on DMap and DMaps structs: Golang does not provide the typical notion of inheritance. because of that I preferred to define the types explicitly. DMap denotes configuration for a particular distributed map. Most of the fields are related with distributed cache implementation.
| 29 | // DMap denotes configuration for a particular distributed map. Most of the |
| 30 | // fields are related with distributed cache implementation. |
| 31 | type DMap struct { |
| 32 | // Engine contains storage engine configuration and their implementations. |
| 33 | // If you don't have a custom storage engine implementation or configuration for |
| 34 | // the default one, just leave it empty. |
| 35 | Engine *Engine |
| 36 | |
| 37 | // MaxIdleDuration denotes maximum time for each entry to stay idle in the |
| 38 | // DMap. It limits the lifetime of the entries relative to the time of the |
| 39 | // last read or write access performed on them. The entries whose idle period |
| 40 | // exceeds this limit are expired and evicted automatically. An entry is idle |
| 41 | // if no Get, GetEntry, Put, Expire on it. Configuration |
| 42 | // of MaxIdleDuration feature varies by preferred deployment method. |
| 43 | MaxIdleDuration time.Duration |
| 44 | |
| 45 | // TTLDuration is useful to set a default TTL for every key/value pair a DMap |
| 46 | // instance. |
| 47 | TTLDuration time.Duration |
| 48 | |
| 49 | // MaxKeys denotes maximum key count on a particular node. So if you have 10 |
| 50 | // nodes with MaxKeys=100000, your key count in the cluster should be around |
| 51 | // MaxKeys*10=1000000 |
| 52 | MaxKeys int |
| 53 | |
| 54 | // MaxInuse denotes maximum amount of in-use memory on a particular node. So |
| 55 | // if you have 10 nodes with MaxInuse=100M (it has to be in bytes), amount of |
| 56 | // in-use memory should be around MaxInuse*10=1G |
| 57 | MaxInuse int |
| 58 | |
| 59 | // LRUSamples denotes amount of randomly selected key count by the approximate |
| 60 | // LRU implementation. Lower values are better for high performance. It's 5 |
| 61 | // by default. |
| 62 | LRUSamples int |
| 63 | |
| 64 | // EvictionPolicy determines the eviction policy in use. It's NONE by default. |
| 65 | // Set as LRU to enable LRU eviction policy. |
| 66 | EvictionPolicy EvictionPolicy |
| 67 | } |
| 68 | |
| 69 | // Sanitize sets default values to empty configuration variables, if it's possible. |
| 70 | func (dm *DMap) Sanitize() error { |
nothing calls this directly
no outgoing calls
no test coverage detected