ssdb

package
v0.0.0-...-edbed3e Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

The package is migrated from beego, you can get from following link: import(

"github.com/beego/beego/v2/client/cache"

) Copyright 2023. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSsdbCache

func NewSsdbCache() cache.Cache

NewSsdbCache creates new ssdb adapter.

Types

type Cache

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

Cache SSDB adapter

func (*Cache) ClearAll

func (rc *Cache) ClearAll(context.Context) error

ClearAll clears all cached items in ssdb. If there are many keys, this method may spent much time.

func (*Cache) Decr

func (rc *Cache) Decr(ctx context.Context, key string) error

Decr decrements a key's counter.

func (*Cache) DelMulti

func (rc *Cache) DelMulti(keys []string) error

DelMulti deletes one or more keys from memcache

func (*Cache) Delete

func (rc *Cache) Delete(ctx context.Context, key string) error

Delete deletes a value in memcache.

func (*Cache) Get

func (rc *Cache) Get(ctx context.Context, key string) (interface{}, error)

Get gets a key's value from memcache.

func (*Cache) GetMulti

func (rc *Cache) GetMulti(ctx context.Context, keys []string) ([]interface{}, error)

GetMulti gets one or keys values from ssdb.

func (*Cache) Incr

func (rc *Cache) Incr(ctx context.Context, key string) error

Incr increases a key's counter.

func (*Cache) IsExist

func (rc *Cache) IsExist(ctx context.Context, key string) (bool, error)

IsExist checks if a key exists in memcache.

func (*Cache) Put

func (rc *Cache) Put(ctx context.Context, key string, val interface{}, timeout time.Duration) error

Put puts value into memcache. value: must be of type string

func (*Cache) Scan

func (rc *Cache) Scan(keyStart string, keyEnd string, limit int) ([]string, error)

Scan key all cached in ssdb.

func (*Cache) StartAndGC

func (rc *Cache) StartAndGC(config string) error

StartAndGC starts the memcache adapter. config: must be in the format {"conn":"connection info"}. If an error occurs during connection, an error is returned

Jump to

Keyboard shortcuts

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