Class CacheManager
- All Implemented Interfaces:
- Serializable,- Cloneable,- ConfigElement,- Searchable,- org.apache.jmeter.testelement.TestElement,- TestIterationListener,- TestStateListener
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.jmeter.testelement.TestElementorg.apache.jmeter.testelement.TestElement.Companion
- 
Field SummaryFieldsFields inherited from class org.apache.jmeter.config.ConfigTestElementPASSWORD, USERNAMEFields inherited from interface org.apache.jmeter.testelement.TestElementCOMMENTS, Companion, ENABLED, GUI_CLASS, NAME, TEST_CLASS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()create a cache manager that share the underlying cache of the current one it allows to use the same cache in different threads which does not inherit from each otherbooleanbooleanintbooleanbooleanDeprecated.booleanbooleanvoidsaveDetails(URLConnection conn, HTTPSampleResult res) Save the Last-Modified, Etag, and Expires headers if the result is cacheable.voidsaveDetails(org.apache.http.HttpResponse method, HTTPSampleResult res) Save the Last-Modified, Etag, and Expires headers if the result is cacheable.voidsetClearEachIteration(boolean clear) voidsetControlledByThread(boolean control) voidsetHeaders(HttpURLConnection conn, Header[] headers, URL url) Check the cache, and if there is a match, set the headers: If-Modified-Since If-None-MatchvoidsetHeaders(URL url, org.apache.http.client.methods.HttpRequestBase request) Check the cache, and if there is a match, set the headers: If-Modified-Since If-None-Match Apache HttpClient version.voidsetMaxSize(int size) voidsetUseExpires(boolean expires) voidCalled once for all threads after the end of a test.voidCalled once for all threads after the end of a test.voidEach time through a Thread Group's test script, an iteration event is fired for each thread.voidCalled just before the start of the test from the main engine thread.voidtestStarted(String host) Called just before the start of the test from the main engine thread.Methods inherited from class org.apache.jmeter.config.ConfigTestElementaddConfigElement, addTestElement, expectsModification, getProps, getSchemaMethods inherited from class org.apache.jmeter.testelement.AbstractTestElementaddPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traversePropertyMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jmeter.config.ConfigElementcloneMethods inherited from interface org.apache.jmeter.testelement.TestElementget, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getPropertyOrNull, getString, removed, removeProperty, set, set, set, set, set, set, set, set, set
- 
Field Details- 
CLEAR- See Also:
 
- 
USE_EXPIRES- See Also:
 
- 
MAX_SIZE- See Also:
 
 
- 
- 
Constructor Details- 
CacheManagerpublic CacheManager()
 
- 
- 
Method Details- 
getControlledByThreadpublic boolean getControlledByThread()
- 
setControlledByThreadpublic void setControlledByThread(boolean control) 
- 
saveDetailsSave the Last-Modified, Etag, and Expires headers if the result is cacheable. Version for Java implementation.- Parameters:
- conn- connection
- res- result
 
- 
saveDetailsSave the Last-Modified, Etag, and Expires headers if the result is cacheable. Version for Apache HttpClient implementation.- Parameters:
- method-- HttpResponseto extract header information from
- res- result to decide if result is cacheable
 
- 
setHeadersCheck the cache, and if there is a match, set the headers:- If-Modified-Since
- If-None-Match
 - Parameters:
- url-- URLto look up in cache
- request- where to set the headers
 
- 
setHeadersCheck the cache, and if there is a match, set the headers:- If-Modified-Since
- If-None-Match
 
- 
inCacheDeprecated.use a version ofinCache(URL, Header[])orinCache(URL, org.apache.jmeter.protocol.http.control.Header[])Check the cache, if the entry has an expires header and the entry has not expired, returntrue- Parameters:
- url-- URLto look up in cache
- Returns:
- trueif entry has an expires header and the entry has not expired, else- false
 
- 
inCache
- 
inCache
- 
getClearEachIterationpublic boolean getClearEachIteration()
- 
setClearEachIterationpublic void setClearEachIteration(boolean clear) 
- 
getUseExpirespublic boolean getUseExpires()
- 
setUseExpirespublic void setUseExpires(boolean expires) 
- 
getMaxSizepublic int getMaxSize()- Returns:
- int cache max size
 
- 
setMaxSizepublic void setMaxSize(int size) - Parameters:
- size- int cache max size
 
- 
clearpublic void clear()Description copied from class:AbstractTestElement- Specified by:
- clearin interface- org.apache.jmeter.testelement.TestElement
- Overrides:
- clearin class- AbstractTestElement
 
- 
createCacheManagerProxycreate a cache manager that share the underlying cache of the current one it allows to use the same cache in different threads which does not inherit from each other- Returns:
- a cache manager that share the underlying cache of the current one
- Since:
- 3.0
 
- 
testStartedpublic void testStarted()Description copied from interface:TestStateListenerCalled just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point. N.B. testStarted() and testEnded() are called from different threads. - Specified by:
- testStartedin interface- TestStateListener
- See Also:
 
- 
testEndedpublic void testEnded()Description copied from interface:TestStateListenerCalled once for all threads after the end of a test. This will use the same element instances as at the start of the test. N.B. testStarted() and testEnded() are called from different threads. - Specified by:
- testEndedin interface- TestStateListener
- See Also:
 
- 
testStartedDescription copied from interface:TestStateListenerCalled just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point. N.B. testStarted() and testEnded() are called from different threads. - Specified by:
- testStartedin interface- TestStateListener
- Parameters:
- host- name of host
- See Also:
 
- 
testEndedDescription copied from interface:TestStateListenerCalled once for all threads after the end of a test. This will use the same element instances as at the start of the test. N.B. testStarted() and testEnded() are called from different threads. - Specified by:
- testEndedin interface- TestStateListener
- Parameters:
- host- name of host
- See Also:
 
- 
testIterationStartDescription copied from interface:TestIterationListenerEach time through a Thread Group's test script, an iteration event is fired for each thread. This will be after the test elements have been cloned, so in general the instance will not be the same as the ones the start/end methods call.- Specified by:
- testIterationStartin interface- TestIterationListener
- Parameters:
- event- the iteration event
 
 
- 
inCache(URL, Header[])orinCache(URL, org.apache.jmeter.protocol.http.control.Header[])