#include <webcache.hh>
Public Types | |
|
typedef std::map< std::string, cachepage, urlcompare > | cachelist |
| Cache list. | |
Public Member Functions | |
| webcache (int maxsize=1024 *1024, bool autocleanup=false) | |
| virtual | ~webcache () |
| Destructor. | |
| bool | add (const char *url, const cachepage &page) |
| bool | lookup (const char *url, cachepage &page) |
| void | cleanup (const Time &now) |
| bool | enableAutoCleanup () |
| void | setMax (int size) |
| int | getMax () const |
| int | size () const |
| bool | reduceCache (int size) |
Protected Attributes | |
| thread::recursivemutex | fMux |
| Mutex. | |
| int | fMaxSize |
| Maximum cache size (kbytes). | |
| cachelist | fCache |
| Cache list. | |
| pthread_t | fCleanupID |
| Thread ID for cleanup task. | |
Classes | |
| class | cachepage |
| Cache page. More... | |
| struct | urlcompare |
| URL compare. More... | |
| web::webcache::webcache | ( | int | maxsize = 1024 *1024, |
|
| bool | autocleanup = false | |||
| ) |
Default constructor. brief Default constructor
| maxsize | Maximum size of cache in bytes | |
| autocleanup | Enable auto cleanup |
| bool web::webcache::add | ( | const char * | url, | |
| const cachepage & | page | |||
| ) |
Add a cache page. brief Add a cache page
| url | Web address | |
| page | Web cache page |
| bool web::webcache::lookup | ( | const char * | url, | |
| cachepage & | page | |||
| ) |
Lookup cache page. brief Lookup cache page
| url | Web address | |
| page | Web cache page (return) |
| void web::webcache::cleanup | ( | const Time & | now | ) |
Cleanup cache. Remove expired entries brief Cleanup cache
| now | Time now |
| bool web::webcache::enableAutoCleanup | ( | ) |
Ask for automatic cleanup. Remove expired entries brief Ask for automatic cleanup
| void web::webcache::setMax | ( | int | size | ) |
Set maximum size of cache. If the requested size is zero, caching is disabled. if the requested size is negative, no limit is applied. brief Set maximum size of cache
| size | Maximum size |
| int web::webcache::getMax | ( | ) | const [inline] |
Get maximum size of cache (bytes) brief Get maximum size of cache
| int web::webcache::size | ( | ) | const |
Get size of cache brief Get size of cache
| bool web::webcache::reduceCache | ( | int | size | ) |
Reduce cache to desired size. Remove expired entries brief Reduce cache to desired size
| size | Desired size |
1.5.4