Documentation
¶
Index ¶
- type Client
- func (c *Client) CopyFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
- func (c *Client) DeleteFile(ctx context.Context, key string) error
- func (c *Client) DownloadFile(ctx context.Context, key string) (io.ReadCloser, string, int64, error)
- func (c *Client) IsFileExists(ctx context.Context, key string) (bool, error)
- func (c *Client) MoveFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
- func (c *Client) UploadFile(ctx context.Context, file io.Reader, key string) (string, error)
- func (c *Client) UploadLocalFile(ctx context.Context, file string, key string) (string, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
urlhandler.Handler
// contains filtered or unexported fields
}
Client provides cache-based storage operations where files are stored in a byte cache. This is useful for temporary storage or small files that benefit from fast cache access.
func NewClient ¶
NewClient creates a new cache-based storage client with the provided configuration and cache backend. If no expiration time is specified, files are cached indefinitely.
func (*Client) CopyFile ¶
func (c *Client) CopyFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
CopyFile duplicates a file from source to destination key within cache storage. Validates overwrite permissions and handles cache expiration settings.
func (*Client) DeleteFile ¶
DeleteFile removes a file from the cache storage.
func (*Client) DownloadFile ¶
func (c *Client) DownloadFile(ctx context.Context, key string) (io.ReadCloser, string, int64, error)
DownloadFile retrieves file data from the cache storage. Returns the file content reader, MIME type based on file extension, and content size.
func (*Client) IsFileExists ¶
IsFileExists checks whether a file exists in the cache storage.
func (*Client) MoveFile ¶
func (c *Client) MoveFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
MoveFile relocates a file from source to destination key within cache storage. This operation copies the file content and then deletes the source.
func (*Client) UploadFile ¶
UploadFile stores file data in the cache with the specified key and expiration time.