public class CacheManager extends ConfigTestElement implements TestStateListener, TestIterationListener, Serializable
Modifier and Type | Field and Description |
---|---|
static String |
CLEAR |
static String |
MAX_SIZE |
static String |
USE_EXPIRES |
PASSWORD, USERNAME
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
Constructor and Description |
---|
CacheManager() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the TestElement of all data.
|
CacheManager |
createCacheManagerProxy()
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 other
|
boolean |
getClearEachIteration() |
boolean |
getControlledByThread() |
int |
getMaxSize() |
boolean |
getUseExpires() |
boolean |
inCache(URL url)
Deprecated.
use a version of
inCache(URL, Header[])
or
inCache(URL, org.apache.jmeter.protocol.http.control.Header[]) |
boolean |
inCache(URL url,
org.apache.http.Header[] allHeaders) |
boolean |
inCache(URL url,
Header[] allHeaders) |
void |
saveDetails(org.apache.http.HttpResponse method,
HTTPSampleResult res)
Save the Last-Modified, Etag, and Expires headers if the result is
cacheable.
|
void |
saveDetails(URLConnection conn,
HTTPSampleResult res)
Save the Last-Modified, Etag, and Expires headers if the result is cacheable.
|
void |
setClearEachIteration(boolean clear) |
void |
setControlledByThread(boolean control) |
void |
setHeaders(HttpURLConnection conn,
Header[] headers,
URL url)
Check the cache, and if there is a match, set the headers:
If-Modified-Since
If-None-Match
|
void |
setHeaders(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.
|
void |
setMaxSize(int size) |
void |
setUseExpires(boolean expires) |
void |
testEnded()
Called once for all threads after the end of a test.
|
void |
testEnded(String host)
Called once for all threads after the end of a test.
|
void |
testIterationStart(LoopIterationEvent event)
Each time through a Thread Group's test script, an iteration event is
fired for each thread.
|
void |
testStarted()
Called just before the start of the test from the main engine thread.
|
void |
testStarted(String host)
Called just before the start of the test from the main engine thread.
|
addConfigElement, addTestElement, expectsModification
addPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, 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, traverseProperty
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
clone
removed
public static final String CLEAR
public static final String USE_EXPIRES
public static final String MAX_SIZE
public boolean getControlledByThread()
public void setControlledByThread(boolean control)
public void saveDetails(URLConnection conn, HTTPSampleResult res)
conn
- connectionres
- resultpublic void saveDetails(org.apache.http.HttpResponse method, HTTPSampleResult res)
method
- HttpResponse
to extract header information fromres
- result to decide if result is cacheablepublic void setHeaders(URL url, org.apache.http.client.methods.HttpRequestBase request)
url
- URL
to look up in cacherequest
- where to set the headerspublic void setHeaders(HttpURLConnection conn, Header[] headers, URL url)
@Deprecated public boolean inCache(URL url)
inCache(URL, Header[])
or
inCache(URL, org.apache.jmeter.protocol.http.control.Header[])
true
url
- URL
to look up in cachetrue
if entry has an expires header and the entry
has not expired, else false
public boolean inCache(URL url, org.apache.http.Header[] allHeaders)
public boolean getClearEachIteration()
public void setClearEachIteration(boolean clear)
public boolean getUseExpires()
public void setUseExpires(boolean expires)
public int getMaxSize()
public void setMaxSize(int size)
size
- int cache max sizepublic void clear()
AbstractTestElement
clear
in interface TestElement
clear
in class AbstractTestElement
public CacheManager createCacheManagerProxy()
public void testStarted()
TestStateListener
Called 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.
testStarted
in interface TestStateListener
StandardJMeterEngine.run()
public void testEnded()
TestStateListener
Called 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.
testEnded
in interface TestStateListener
StandardJMeterEngine.stopTest()
public void testStarted(String host)
TestStateListener
Called 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.
testStarted
in interface TestStateListener
host
- name of hostStandardJMeterEngine.run()
public void testEnded(String host)
TestStateListener
Called 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.
testEnded
in interface TestStateListener
host
- name of hostStandardJMeterEngine.stopTest()
public void testIterationStart(LoopIterationEvent event)
TestIterationListener
testIterationStart
in interface TestIterationListener
event
- the iteration eventCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.