Skip to content

Commit 05cb242

Browse files
committed
Add a small utility to help with dealing with time units
1 parent 0b98c96 commit 05cb242

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

  • objectcache/src/main/java/com/myntra/objectcache
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.myntra.objectcache;
2+
3+
import java.util.concurrent.TimeUnit;
4+
5+
/**
6+
* @author mario
7+
* A small helper class to set expiry for the cache
8+
*/
9+
public class Expiry {
10+
public static long MINUTES(long minutes) {
11+
return TimeUnit.MINUTES.toMillis(minutes);
12+
}
13+
public static long SECONDS(long seconds) {
14+
return TimeUnit.SECONDS.toMillis(seconds);
15+
}
16+
public static long HOURS(long hours) {
17+
return TimeUnit.HOURS.toMillis(hours);
18+
}
19+
public static long DAYS(long days) {
20+
return TimeUnit.DAYS.toMillis(days);
21+
}
22+
}

0 commit comments

Comments
 (0)