Skip to content

Cache client not honoring Expiry #94

Description

@rhinmass

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions