Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
K
key_value-server
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amir.yosef
key_value-server
Commits
ed221821
Commit
ed221821
authored
Aug 20, 2024
by
amir.yosef
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update logging for Storage class
parent
550d8911
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Storage.java
src/storage/Storage.java
+3
-3
No files found.
src/storage/Storage.java
View file @
ed221821
package
storage
;
package
storage
;
import
model.RdbFile
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.logging.Logger
;
public
class
Storage
{
public
class
Storage
{
private
final
int
capacity
=
10000
;
private
final
int
capacity
=
10000
;
private
static
final
Logger
logger
=
Logger
.
getLogger
(
Storage
.
class
.
getName
());
private
final
CachePolicy
<
String
,
String
>
storage
;
private
final
CachePolicy
<
String
,
String
>
storage
;
private
final
Map
<
String
,
Long
>
timeToExpiration
=
new
ConcurrentHashMap
<>(
capacity
);
private
final
Map
<
String
,
Long
>
timeToExpiration
=
new
ConcurrentHashMap
<>(
capacity
);
private
final
Map
<
String
,
Long
>
currentTimeForKey
=
new
ConcurrentHashMap
<>(
capacity
);
private
final
Map
<
String
,
Long
>
currentTimeForKey
=
new
ConcurrentHashMap
<>(
capacity
);
...
@@ -49,7 +49,7 @@ public class Storage {
...
@@ -49,7 +49,7 @@ public class Storage {
long
currentTime
=
System
.
currentTimeMillis
();
long
currentTime
=
System
.
currentTimeMillis
();
long
expirationTime
=
timeToExpiration
.
get
(
key
);
long
expirationTime
=
timeToExpiration
.
get
(
key
);
if
(
currentTime
>
expirationTime
)
{
if
(
currentTime
>
expirationTime
)
{
System
.
out
.
println
(
"Key expired: "
+
key
);
logger
.
info
(
"Key expired: "
+
key
);
return
true
;
return
true
;
}
}
}
}
...
...
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