store

package module
v0.0.0-...-28f8d39 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

store

Documentation

Overview

* @Author: leon 714765233@qq.com * @Date: 2024/7/17 18:56:00 * @File: store.go * @Description: * * Copyright (c) 2024 by leon email:714765233@qq.com, All Rights Reserved.

* @Author: leon 714765233@qq.com * @Date: 2024/7/17 18:59:00 * @File: types.go * @Description: * * Copyright (c) 2024 by leon email:714765233@qq.com, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Get 当`timeout > 0`且缓存命中时,设置/重置`key`的过期时间
	Get(ctx context.Context, key string, timeout ...time.Duration) (val *gvar.Var, err error)
	// Set 当`timeout > 0`时,设置/重置`key`的过期时间
	Set(ctx context.Context, key string, val any, timeout ...time.Duration) (err error)
}

type GetContentReq

type GetContentReq struct {
	Key string `json:"key"`
}

type GetContentRes

type GetContentRes struct {
	Content string `json:"content"`
}

type OssManager

type OssManager interface {
	// GetObject 从oss 获取文件
	GetObject(ctx context.Context, file string) (b []byte, err error)
}

type Store

type Store struct {
	Oss OssManager // oss下载管理器
	// contains filtered or unexported fields
}

func New

func New(cache Cache, ossManager OssManager) *Store

func (*Store) GetContent

func (s *Store) GetContent(ctx context.Context, req *GetContentReq) (content string, err error)

Jump to

Keyboard shortcuts

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