aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/yandex/tvm/cachedtvm/opts.go
diff options
context:
space:
mode:
authorqrort <qrort@yandex-team.com>2022-11-30 23:47:12 +0300
committerqrort <qrort@yandex-team.com>2022-11-30 23:47:12 +0300
commit22f8ae0e3f5d68b92aecccdf96c1d841a0334311 (patch)
treebffa27765faf54126ad44bcafa89fadecb7a73d7 /library/go/yandex/tvm/cachedtvm/opts.go
parent332b99e2173f0425444abb759eebcb2fafaa9209 (diff)
downloadydb-22f8ae0e3f5d68b92aecccdf96c1d841a0334311.tar.gz
validate canons without yatest_common
Diffstat (limited to 'library/go/yandex/tvm/cachedtvm/opts.go')
-rw-r--r--library/go/yandex/tvm/cachedtvm/opts.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/library/go/yandex/tvm/cachedtvm/opts.go b/library/go/yandex/tvm/cachedtvm/opts.go
new file mode 100644
index 0000000000..0df9dfa89e
--- /dev/null
+++ b/library/go/yandex/tvm/cachedtvm/opts.go
@@ -0,0 +1,40 @@
+package cachedtvm
+
+import "time"
+
+type (
+ Option interface{ isCachedOption() }
+
+ cacheOptions struct {
+ ttl time.Duration
+ maxItems int64
+ }
+
+ OptionServiceTicket struct {
+ Option
+ cacheOptions
+ }
+
+ OptionUserTicket struct {
+ Option
+ cacheOptions
+ }
+)
+
+func WithCheckServiceTicket(ttl time.Duration, maxSize int) Option {
+ return OptionServiceTicket{
+ cacheOptions: cacheOptions{
+ ttl: ttl,
+ maxItems: int64(maxSize),
+ },
+ }
+}
+
+func WithCheckUserTicket(ttl time.Duration, maxSize int) Option {
+ return OptionUserTicket{
+ cacheOptions: cacheOptions{
+ ttl: ttl,
+ maxItems: int64(maxSize),
+ },
+ }
+}