cache

package
v0.0.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the Apache License, Version 2.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncMap

type SyncMap struct {
	// contains filtered or unexported fields
}

SyncMap is a map with synchronized access support

func MakeSyncMap

func MakeSyncMap(maxEntries int) *SyncMap

MakeSyncMap 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.

func (*SyncMap) Delete

func (sm *SyncMap) Delete(key string)

Delete removes the entry with the specified key from the SyncMap. If the key does not exist, this method does nothing.

func (*SyncMap) Get

func (sm *SyncMap) Get(key string) (entry interface{}, ok bool)

Get retrieves the value associated with the given key from the SyncMap. It returns the value and a boolean indicating whether the key was found.

func (*SyncMap) Set

func (sm *SyncMap) Set(key string, entry interface{})

Set sets a new entry or updates an existing one. Set adds or updates an entry in the SyncMap with the specified key. If the key already exists in the map, the entry will be updated. If the key does not exist and the map is at capacity, some entries will be evicted first.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL