Documentation ¶
Index ¶
- func NewCloudflareClient(apiKey string, email string, accountID string) *cloudflare.API
- func NewRedisClient(redisURL string) *redis.Client
- type Client
- func (opt *Client) CloudflareKVDelete(key string, namespaceID string) (bool, error)
- func (opt *Client) CloudflareKVListKeysByPrefix(prefix string, namespaceID string) ([]string, error)
- func (opt *Client) CloudflareKVRead(key string, namespaceID string) ([]byte, error)
- func (opt *Client) CloudflareKVWrite(key string, value []byte, namespaceID string) (bool, error)
- func (opt *Client) Delete(key string, namespaceID string) (bool, error)
- func (opt *Client) ListKeysByPrefix(prefix string, namespaceID string) ([]string, error)
- func (opt *Client) Read(key string, namespaceID string) ([]byte, error)
- func (opt *Client) RedisDelete(key string) (bool, error)
- func (opt *Client) RedisListKeysByPrefix(prefix string) ([]string, error)
- func (opt *Client) RedisRead(key string) ([]byte, error)
- func (opt *Client) RedisWrite(key string, value []byte) (bool, error)
- func (opt *Client) Write(key string, value []byte, namespaceID string) (bool, error)
- type KV
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCloudflareClient ¶
NewCloudflareClient returns a new Cloudflare v4 API client
func NewRedisClient ¶
func NewRedisClient(redisURL string) *redis.Client
NewRedisClient returns a client to the Redis Server
Types ¶
type Client ¶ added in v1.0.2
type Client struct {
// contains filtered or unexported fields
}
Client represent Cloudflare and Redis client information
func New ¶
func New(redisURL string, cloudflareApiKey string, cloudflareEmail string, cloudflareAccountID string) *Client
New returns a client for Redis and CloudFlare KV
func (*Client) CloudflareKVDelete ¶ added in v1.0.2
CloudflareKVDelete deletes a key and value for a provided storage namespace
func (*Client) CloudflareKVListKeysByPrefix ¶ added in v1.0.2
func (opt *Client) CloudflareKVListKeysByPrefix(prefix string, namespaceID string) ([]string, error)
CloudflareKVListKeysByPrefix returns keys that matches the prefix
func (*Client) CloudflareKVRead ¶ added in v1.0.2
CloudflareKVRead returns the value associated with the given key in the given namespace
func (*Client) CloudflareKVWrite ¶ added in v1.0.2
CloudflareKVWrite writes a value identified by a key.
func (*Client) ListKeysByPrefix ¶ added in v1.0.2
ListKeysByPrefix returns keys that matches the prefix
func (*Client) Read ¶ added in v1.0.2
Read returns the value associated with the given key in the given redis server or Cloudflare KV namespace
func (*Client) RedisDelete ¶ added in v1.0.2
RedisDelete deletes a key and value
func (*Client) RedisListKeysByPrefix ¶ added in v1.0.2
RedisListKeysByPrefix returns keys that matches the prefix
func (*Client) RedisWrite ¶ added in v1.0.2
RedisWrite writes a value identified by a key.
type KV ¶
type KV interface { Read(key string, namespaceID string) ([]byte, error) Write(key string, value []byte, namespaceID string) (bool, error) ListKeysByPrefix(prefix string, namespaceID string) ([]string, error) Delete(key string, namespaceID string) (bool, error) RedisRead(key string) ([]byte, error) RedisWrite(key string, value []byte) (bool, error) RedisListKeysByPrefix(prefix string) ([]string, error) RedisDelete(key string) (bool, error) CloudflareKVRead(key string, namespaceID string) ([]byte, error) CloudflareKVWrite(key string, value []byte, namespaceID string) (bool, error) CloudflareKVListKeysByPrefix(prefix string, namespaceID string) ([]string, error) CloudflareKVDelete(key string, namespaceID string) (bool, error) }
KV is a type that implements a Redis and Cloudflare key-value store.