-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from 1infras/feature/multiple-cache
Refactor multiple cache
- Loading branch information
Showing
3 changed files
with
13 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
package cache | ||
|
||
import "time" | ||
import ( | ||
"context" | ||
"time" | ||
) | ||
|
||
type Cache interface { | ||
//Set cache with optional expiration time, set 0 if the cache would be infinity | ||
Set(key string, values []byte, expiration time.Duration) (bool, error) | ||
//Get cache by key | ||
Get(key string) ([]byte, error) | ||
//SetCtx cache with optional expiration time, set 0 if the cache would be infinity, support tracing | ||
SetCtx(ctx context.Context, key string, values []byte, expiration time.Duration) (bool, error) | ||
//Get cache by key, support tracing | ||
GetCtx(ctx context.Context, key string) ([]byte, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters