aboutsummaryrefslogtreecommitdiff
path: root/weed/operation/lookup_vid_cache_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/operation/lookup_vid_cache_test.go')
-rw-r--r--weed/operation/lookup_vid_cache_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/weed/operation/lookup_vid_cache_test.go b/weed/operation/lookup_vid_cache_test.go
new file mode 100644
index 000000000..9c9e2affb
--- /dev/null
+++ b/weed/operation/lookup_vid_cache_test.go
@@ -0,0 +1,26 @@
+package operation
+
+import (
+ "fmt"
+ "testing"
+ "time"
+)
+
+func TestCaching(t *testing.T) {
+ var (
+ vc VidCache
+ )
+ var locations []Location
+ locations = append(locations, Location{Url: "a.com:8080"})
+ vc.Set("123", locations, time.Second)
+ ret, _ := vc.Get("123")
+ if ret == nil {
+ t.Fatal("Not found vid 123")
+ }
+ fmt.Printf("vid 123 locations = %v\n", ret)
+ time.Sleep(2 * time.Second)
+ ret, _ = vc.Get("123")
+ if ret != nil {
+ t.Fatal("Not found vid 123")
+ }
+}