The Cache class provides a global memory cache of previously retrieved URLs. More...
Publicly inherits QObject.
Cache | ( ); | |
void | clear | ( ); |
bool | getUrl | ( Request* request, const Url& url, bool reload ); |
~Cache | ( ); |
void | connDestroyed | ( ); |
void | data | ( const char* bytes, int length ); |
void | endOfData | ( ); |
void | requestDone | ( Request* req ); |
void | startOfData | ( QString mediaType, QString mediaSubtype, int totalSize ); |
void | timerEvent | ( QTimerEvent* e ); |
CacheData* | findActive | ( const Url& url ); |
CacheData* | findActive | ( Connection* conn ); |
CacheData* | findData | ( const Url& url ); |
QList<CacheData> | _active; |
QList<CacheData> | _data; |
QList<Req> | _pending; |
QList<Req> | _reqs; |
The Cache class provides a global memory cache of previously retrieved URLs.
The Cache is a global object that is used by the Request class to retrieve data, given a URL. As data is retrieved, it is stored in an in-memory cache for quick retrieval by future Requests. In addition, if multiple Requests ask for a URL that is in the process of beign retrieved, the Cache will automatically connect all of the Requests to a single Connection to improve efficiency.The in-memory cache can grow to any size, and it is currently not limited. However, it can be manually cleared.
Create a new Cache.
Free all cached data.
Process a request from a Request for a URL. If the requested URL has already been retrieved or is being retrieved, connect the Request to the existing CacheData. Otherwise, create a new CacheData and connection, and connect them to the Request.
Delete all cached data.
The open connection has been destroyed for some reason. Remove the associated CacheData, as it is not complete.
Append the incoming data to the associated CacheData object.
Mark the data as complete, and store it in the cache. Data retrieved through the "file" method is not cached.
Process the notification from a request that it has been aborted. If no other requests are waiting on the same data, abort the connection and delete the associated CacheData.
Store the media type, and the total data length.
This is where Requests are actually connected with open Connections. For each pending Request, locate its associated CacheData. If the startOfData signal has already been received by the CacheData, forward the information to the Request now. If there is any existing data, forward it to the Request now. If the CacheData is complete, forward the endOfData signal to the Request now.
Find the CacheData in the active list associated with the given URL.
Find the CacheData in the active list associated with the given connection.
Find the CacheData in the cache list associated with the given URL.