Server IP : 103.119.228.120 / Your IP : 3.144.41.200 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "LWP::ConnCache 3" .TH LWP::ConnCache 3 "2018-07-16" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" LWP::ConnCache \- Connection cache manager .SH "NOTE" .IX Header "NOTE" This module is experimental. Details of its interface is likely to change in the future. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use LWP::ConnCache; \& my $cache = LWP::ConnCache\->new; \& $cache\->deposit($type, $key, $sock); \& $sock = $cache\->withdraw($type, $key); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \f(CW\*(C`LWP::ConnCache\*(C'\fR class is the standard connection cache manager for LWP::UserAgent. .SH "METHODS" .IX Header "METHODS" The following basic methods are provided: .SS "new" .IX Subsection "new" .Vb 1 \& my $cache = LWP::ConnCache\->new( %options ) .Ve .PP This method constructs a new LWP::ConnCache object. The only option currently accepted is \f(CW\*(C`total_capacity\*(C'\fR. If specified it initialize the \*(L"total_capacity\*(R" in LWP::ConnCache option. It defaults to \f(CW1\fR. .SS "total_capacity" .IX Subsection "total_capacity" .Vb 4 \& my $cap = $cache\->total_capacity; \& $cache\->total_capacity(0); # drop all immediately \& $cache\->total_capacity(undef); # no limit \& $cache\->total_capacity($number); .Ve .PP Get/sets the number of connection that will be cached. Connections will start to be dropped when this limit is reached. If set to \f(CW0\fR, then all connections are immediately dropped. If set to \f(CW\*(C`undef\*(C'\fR, then there is no limit. .SS "capacity" .IX Subsection "capacity" .Vb 2 \& my $http_capacity = $cache\->capacity(\*(Aqhttp\*(Aq); \& $cache\->capacity(\*(Aqhttp\*(Aq, 2 ); .Ve .PP Get/set a limit for the number of connections of the specified type that can be cached. The first parameter is a short string like \&\*(L"http\*(R" or \*(L"ftp\*(R". .SS "drop" .IX Subsection "drop" .Vb 10 \& $cache\->drop(); # Drop ALL connections \& # which is just a synonym for: \& $cache\->drop(sub{1}); # Drop ALL connections \& # drop all connections older than 22 seconds and add a reason for it! \& $cache\->drop(22, "Older than 22 secs dropped"); \& # which is just a synonym for: \& $cache\->drop(sub { \& my ($conn, $type, $key, $deposit_time) = @_; \& if ($deposit_time < 22) { \& # true values drop the connection \& return 1; \& } \& # false values don\*(Aqt drop the connection \& return 0; \& }, "Older than 22 secs dropped" ); .Ve .PP Drop connections by some criteria. The \f(CW$checker\fR argument is a subroutine that is called for each connection. If the routine returns a \s-1TRUE\s0 value then the connection is dropped. The routine is called with ($conn, \f(CW$type\fR, \f(CW$key\fR, \f(CW$deposit_time\fR) as arguments. .PP Shortcuts: If the \f(CW$checker\fR argument is absent (or \f(CW\*(C`undef\*(C'\fR) all cached connections are dropped. If the \f(CW$checker\fR is a number then all connections untouched that the given number of seconds or more are dropped. If \f(CW$checker\fR is a string then all connections of the given type are dropped. .PP The \f(CW\*(C`reason\*(C'\fR is passed on to the \*(L"dropped\*(R" in LWP::ConnCache method. .SS "prune" .IX Subsection "prune" .Vb 1 \& $cache\->prune(); .Ve .PP Calling this method will drop all connections that are dead. This is tested by calling the \*(L"ping\*(R" in LWP::ConnCache method on the connections. If the \*(L"ping\*(R" in LWP::ConnCache method exists and returns a false value, then the connection is dropped. .SS "get_types" .IX Subsection "get_types" .Vb 1 \& my @types = $cache\->get_types(); .Ve .PP This returns all the \f(CW\*(C`type\*(C'\fR fields used for the currently cached connections. .SS "get_connections" .IX Subsection "get_connections" .Vb 2 \& my @conns = $cache\->get_connections(); # all connections \& my @conns = $cache\->get_connections(\*(Aqhttp\*(Aq); # connections for http .Ve .PP This returns all connection objects of the specified type. If no type is specified then all connections are returned. In scalar context the number of cached connections of the specified type is returned. .SH "PROTOCOL METHODS" .IX Header "PROTOCOL METHODS" The following methods are called by low-level protocol modules to try to save away connections and to get them back. .SS "deposit" .IX Subsection "deposit" .Vb 1 \& $cache\->deposit($type, $key, $conn); .Ve .PP This method adds a new connection to the cache. As a result, other already cached connections might be dropped. Multiple connections with the same type/key might be added. .SS "withdraw" .IX Subsection "withdraw" .Vb 1 \& my $conn = $cache\->withdraw($type, $key); .Ve .PP This method tries to fetch back a connection that was previously deposited. If no cached connection with the specified \f(CW$type\fR/$key is found, then \f(CW\*(C`undef\*(C'\fR is returned. There is not guarantee that a deposited connection can be withdrawn, as the cache manger is free to drop connections at any time. .SH "INTERNAL METHODS" .IX Header "INTERNAL METHODS" The following methods are called internally. Subclasses might want to override them. .SS "enforce_limits" .IX Subsection "enforce_limits" .Vb 1 \& $conn\->enforce_limits([$type]) .Ve .PP This method is called with after a new connection is added (deposited) in the cache or capacity limits are adjusted. The default implementation drops connections until the specified capacity limits are not exceeded. .SS "dropping" .IX Subsection "dropping" .Vb 1 \& $conn\->dropping($conn_record, $reason) .Ve .PP This method is called when a connection is dropped. The record belonging to the dropped connection is passed as the first argument and a string describing the reason for the drop is passed as the second argument. The default implementation makes some noise if the \&\f(CW$LWP::ConnCache::DEBUG\fR variable is set and nothing more. .SH "SUBCLASSING" .IX Header "SUBCLASSING" For specialized cache policy it makes sense to subclass \&\f(CW\*(C`LWP::ConnCache\*(C'\fR and perhaps override the \*(L"deposit\*(R" in LWP::ConnCache, \&\*(L"enforce_limits\*(R" in LWP::ConnCache, and \*(L"dropping\*(R" in LWP::ConnCache methods. .PP The object itself is a hash. Keys prefixed with \f(CW\*(C`cc_\*(C'\fR are reserved for the base class. .SH "SEE ALSO" .IX Header "SEE ALSO" LWP::UserAgent .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2001 Gisle Aas. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.