package sample

// A Cache service mimics the memcache interface.
type Cache interface {
    // Set sets a value for a key.
    Set(key string, value any) error

    // Get returns the value for a key.  If the value is not found, returns
    // a not found error.
    Get(key string) (any, error)

    // Same as Get, but casts the return argument to an byte.
    GetAsByte(key string) (byte, error)
    // Same as Get, but casts the return argument to an int32.
    GetAsInt32(key string) (int32, error)
    // Same as Get, but casts the return argument to an int64.
    GetAsInt64(key string) (int64, error)
    // Same as Get, but casts the return argument to an uint32.
    GetAsUint32(key string) (uint32, error)
    // Same as Get, but casts the return argument to an uint64.
    GetAsUint64(key string) (uint64, error)
    // Same as Get, but casts the return argument to an float32.
    GetAsFloat32(key string) (float32, error)
    // Same as Get, but casts the return argument to an float64.
    GetAsFloat64(key string) (float64, error)
    // Same as Get, but casts the return argument to a string.
    GetAsString(key string) (string, error)
    // Same as Get, but casts the return argument to a bool.
    GetAsBool(key string) (bool, error)
    // Same as Get, but casts the return argument to an error.
    GetAsError(key string) (error, error)

    // AsMap returns the full contents of the cache as a map.
    AsMap() (map[string]any, error)

    // KeyValuePairs returns the full contents of the cache as a slice of pairs.
    KeyValuePairs() ([]KeyValuePair, error)

    // MostRecentSet returns the key and value and the timestamp for the most
    // recent set operation
    // TODO(bprosnitz) support type types and change time to native time type
    MostRecentSet() (value KeyValuePair, time int64, err error)

    // KeyPage indexes into the keys (in alphanumerically sorted order) and
    // returns the indexth page of 10 keys.
    KeyPage(index int64) ([10]string, error)

    // Size returns the total number of entries in the cache.
    Size() (int64, error)

    // MultiGet sets up a stream that allows fetching multiple keys.
    MultiGet() stream<string, any> error
}

// KeyValuePair is a representation of a cached key and value pair.
type KeyValuePair struct {
    Key string
    Value any
}
