mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2677 - Fix for trim failing on mutation of lastAccessTime
Currently, lastAccessTime can mutate during cache trim processing. This fixes this issue by taking a copy of the lastAccessTime storing as lastAccessSort and using that for sorting for cache trim.
This commit is contained in:
Vendored
+3
-8
@@ -10,13 +10,11 @@ import org.junit.jupiter.api.Test;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class DefaultServerCache_RunEvictionTest {
|
||||
|
||||
class DefaultServerCache_RunEvictionTest {
|
||||
|
||||
private DefaultServerCache createCache() {
|
||||
|
||||
ServerCacheOptions cacheOptions = new ServerCacheOptions();
|
||||
cacheOptions.setMaxSize(10000);
|
||||
cacheOptions.setMaxSize(300);
|
||||
cacheOptions.setMaxIdleSecs(1);
|
||||
cacheOptions.setMaxSecsToLive(2);
|
||||
cacheOptions.setTrimFrequency(1);
|
||||
@@ -35,8 +33,7 @@ public class DefaultServerCache_RunEvictionTest {
|
||||
|
||||
@Disabled("test takes long time")
|
||||
@Test
|
||||
public void runEvict() throws InterruptedException {
|
||||
|
||||
void runEvict() throws InterruptedException {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
doStuff();
|
||||
cache.runEviction();
|
||||
@@ -47,10 +44,8 @@ public class DefaultServerCache_RunEvictionTest {
|
||||
}
|
||||
|
||||
private void doStuff() {
|
||||
|
||||
for (int i = 0; i < 500; i++) {
|
||||
String key = "" + random.nextInt(20000);
|
||||
|
||||
int mode = random.nextInt(10);
|
||||
if (mode < 8) {
|
||||
cache.get(key);
|
||||
|
||||
Reference in New Issue
Block a user