NewSyncMap creates a new SyncMap with the specified maximum number of entries. If the maximum number of entries is less than or equal to 0, it will be set to 1.
(maxEntries int)
| 64 | // NewSyncMap creates a new SyncMap with the specified maximum number of entries. |
| 65 | // If the maximum number of entries is less than or equal to 0, it will be set to 1. |
| 66 | func NewSyncMap(maxEntries int) *SyncMap { |
| 67 | if maxEntries <= 0 { |
| 68 | maxEntries = 1 |
| 69 | } |
| 70 | return &SyncMap{mapObj: &map[string]interface{}{}, |
| 71 | lock: &sync.RWMutex{}, |
| 72 | capacity: maxEntries, |
| 73 | evictionPercentage: defaultEvictionPercentage} |
| 74 | } |
no outgoing calls