Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache client not honoring Expiry #94

Open
rhinmass opened this issue May 22, 2020 · 0 comments
Open

Cache client not honoring Expiry #94

rhinmass opened this issue May 22, 2020 · 0 comments

Comments

@rhinmass
Copy link

rhinmass commented May 22, 2020

I'm not seeing entries expiring according to the Expiry date.

	public static void main(String[] args) throws InterruptedException {	
 		String[] servers = { "localhost:11212" };
		Integer[] weights = {1}; 
		SockIOPool pool = SockIOPool.getInstance("Test2");
		pool.setServers( servers );
		pool.setWeights(weights);
		pool.setMinConn(2);
		pool.setMaxConn(20);
		pool.setFailover( true );
		pool.setInitConn( 30 );
		pool.setMaintSleep( 90 );
		pool.setSocketTO( 2000 );
		pool.setAliveCheck( true );
		pool.initialize();
		MemCachedClient mcc = new MemCachedClient("Test2");

     	Date expiration = new Date(System.currentTimeMillis()+3000);		
		mcc.set("pet", "cat", expiration);
		String value = (String) mcc.get("pet");
		System.out.println("before sleep: got " + value + " from the cache");
		Thread.sleep(4000);
		value = (String) mcc.get("pet");
		System.out.println("after sleep: got " + value + " from the cache");
	}

Results:
before sleep: got cat from the cache
after sleep: got cat from the cache

I expected the second get to return null, as the entry should have expired in 3 seconds. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant