Class HTTP_Connection_Cache

Description

HTTP Connection Class

Use to hold HTTP Connections.

This class is based on ConnCache.pm, although this a much lighter version. <http://search.cpan.org/author/GAAS/libwww-perl-5.65/lib/LWP/ConnCache.pm> from the libwww-perl collection <http://www.linpro.no/lwp/>.

Example:


1 $conn_cache =& new HTTP_Connection_Cache();
2 $conn_cache->deposit($key, $sock);
3 $connection =& $conn_cache->withdraw($key);

See test_HTTP_Connection_Cache.php for more examples

TODO:

  • none yet

Located in Program_Root/HTTP_Connection_Cache.php (line 49)


	
			
Variable Summary
Method Summary
void HTTP_Connection_Cache ([array $options = null])
void configure (array $options)
int count ()
bool deposit (string $key, object &$connection)
void destroy ()
bool drop (string $key)
bool remove (string $key)
void set_total_capacity (int $total_capacity)
object false &withdraw (string $key)
void _enforce_limits ()
Variables
array $cache = array() (line 55)

Cache

array $key_order = array() (line 61)

Cache key order

int $total_capacity = 1 (line 67)

Total capacity allowed in cache

Methods
Constructor HTTP_Connection_Cache (line 78)

Constructor.

The only option currently accepted is 'total_capacity'. Example:


1 $conn_cache =& new HTTP_Connection_Cache(array('total_capacity' => 5));

void HTTP_Connection_Cache ([array $options = null])
  • array $options:

    associative array

configure (line 87)

Configure

void configure (array $options)
  • array $options
count (line 200)

Get total count

int count ()
deposit (line 124)

Deposit connection

bool deposit (string $key, object &$connection)
  • string $key
  • object $connection:

    (passed by ref)

destroy (line 209)

Destroy (drops all connections)

void destroy ()
drop (line 164)

Drop connection (disconnects)

bool drop (string $key)
  • string $key
get_total_capacity (line 113)

Get total capacity

  • return:

    false if unset

int get_total_capacity ()
remove (line 147)

Remove connection (doesn't disconnect, just removes from cache)

bool remove (string $key)
  • string $key
set_total_capacity (line 103)

Set total capacity.

Connections will start to be dropped when this limit is reached. If set to 0, then all connections are immediately dropped.

void set_total_capacity (int $total_capacity)
  • int $total_capacity
withdraw (line 186)

Withdraw connection

Example:


1 $key = 'www.k1m.com:80';
2 $connection =& $conn_cache->withdraw($key);

  • return:

    on error

object false &withdraw (string $key)
  • string $key
_enforce_limits (line 222)

Enforce limits

void _enforce_limits ()

Documention generated on Wed, 16 Jul 2003 01:03:19 +0100 by phpDocumentor 1.2.0