func TestCacheAccessCleanup(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	assert.Logf("testing cache access based cleanup")
	cache := jwt.NewCache(time.Second, time.Second, time.Second, 10)
	key := []byte("secret")
	claims := initClaims()
	jwtIn, err := jwt.Encode(claims, key, jwt.HS512)
	assert.Nil(err)
	cache.Put(jwtIn)
	token := jwtIn.String()
	jwtOut, ok := cache.Get(token)
	assert.True(ok)
	assert.Equal(jwtIn, jwtOut)
	// Now wait a bit an try again.
	time.Sleep(5 * time.Second)
	jwtOut, ok = cache.Get(token)
	assert.False(ok)
	assert.Nil(jwtOut)
}
// TestCacheAccessCleanup tests the access based cleanup
// of the JWT cache.
TestCacheAccessCleanup tests the access based cleanup
of the JWT cache.
// TestCacheAccessCleanup tests the access based cleanup // of the JWT cache .
func TestCacheAccessCleanup(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	assert.Logf("testing cache access based cleanup")
	cache := jwt.NewCache(time.Second, time.Second, time.Second, 10)
	key := []byte("secret")
	claims := initClaims()
	jwtIn, err := jwt.Encode(claims, key, jwt.HS512)
	assert.Nil(err)
	cache.Put(jwtIn)
	token := jwtIn.String()
	jwtOut, ok := cache.Get(token)
	assert.True(ok)
	assert.Equal(jwtIn, jwtOut)
	time.Sleep(5 * time.Second)
	jwtOut, ok = cache.Get(token)
	assert.False(ok)
	assert.Nil(jwtOut)
}
func TestCacheAccessCleanup ( t * testing . T ) { assert := audit . NewTestingAssertion ( t , true ) assert . Logf ( " " ) cache := jwt . NewCache ( time . Second , time . Second , time . Second , 10 ) key := [ ] byte ( " " ) claims := initClaims ( ) jwtIn , err := jwt . Encode ( claims , key , jwt . HS512 ) assert . Nil ( err ) cache . Put ( jwtIn ) token := jwtIn . String ( ) jwtOut , ok := cache . Get ( token ) assert . True ( ok ) assert . Equal ( jwtIn , jwtOut ) time . Sleep ( 5 * time . Second ) jwtOut , ok = cache . Get ( token ) assert . False ( ok ) assert . Nil ( jwtOut ) }
TestCacheAccessCleanup tests the access based cleanup
of the JWT cache.
TestCacheAccessCleanup tests the access based cleanup of the JWT cache .
// Now wait a bit an try again.