Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0bd47567
Commit
0bd47567
authored
Sep 08, 2016
by
Takashi Kusumi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LRUExpireCache#Get requires write lock
parent
dc529a03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
lruexpirecache.go
pkg/util/cache/lruexpirecache.go
+3
-3
No files found.
pkg/util/cache/lruexpirecache.go
View file @
0bd47567
...
@@ -25,7 +25,7 @@ import (
...
@@ -25,7 +25,7 @@ import (
type
LRUExpireCache
struct
{
type
LRUExpireCache
struct
{
cache
*
lru
.
Cache
cache
*
lru
.
Cache
lock
sync
.
RW
Mutex
lock
sync
.
Mutex
}
}
func
NewLRUExpireCache
(
maxSize
int
)
*
LRUExpireCache
{
func
NewLRUExpireCache
(
maxSize
int
)
*
LRUExpireCache
{
...
@@ -46,8 +46,8 @@ func (c *LRUExpireCache) Add(key lru.Key, value interface{}, ttl time.Duration)
...
@@ -46,8 +46,8 @@ func (c *LRUExpireCache) Add(key lru.Key, value interface{}, ttl time.Duration)
}
}
func
(
c
*
LRUExpireCache
)
Get
(
key
lru
.
Key
)
(
interface
{},
bool
)
{
func
(
c
*
LRUExpireCache
)
Get
(
key
lru
.
Key
)
(
interface
{},
bool
)
{
c
.
lock
.
R
Lock
()
c
.
lock
.
Lock
()
defer
c
.
lock
.
R
Unlock
()
defer
c
.
lock
.
Unlock
()
e
,
ok
:=
c
.
cache
.
Get
(
key
)
e
,
ok
:=
c
.
cache
.
Get
(
key
)
if
!
ok
{
if
!
ok
{
return
nil
,
false
return
nil
,
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment