コード例 #1
0
 @Test
 public void remove_A$String() throws Exception {
   MemcachedSessionStore store = new MemcachedSessionStore(getMemcached());
   // given
   String key = "MemcachedSessionStoreTest#remove_A$String_" + System.currentTimeMillis();
   // when
   store.set(key, 60, "aaa");
   store.remove(key);
   String actual = store.get(key);
   // then
   assertThat(actual, is(nullValue()));
 }
コード例 #2
0
 @Test
 public void get_A$String() throws Exception {
   MemcachedSessionStore store = new MemcachedSessionStore(getMemcached());
   // given
   String key = "MemcachedSessionStoreTest#get_A$String_" + System.currentTimeMillis();
   String value = "cached" + System.currentTimeMillis();
   store.set(key, 60, value);
   // when
   String actual = store.get(key);
   // then
   assertThat(actual, is(equalTo(value)));
 }
コード例 #3
0
 @Test
 public void set_A$String$int$Object_Expire() throws Exception {
   MemcachedSessionStore store = new MemcachedSessionStore(getMemcached());
   // given
   String key = "MemcachedSessionStoreTest#set_A$String$int$Object_" + System.currentTimeMillis();
   int expire = 2;
   String value = "aaa";
   // when
   store.set(key, expire, value);
   Thread.sleep(3000L);
   String actual = store.get(key);
   // then
   assertThat(actual, is(nullValue()));
 }