home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
plum2_33_1.lzh
/
module
/
auto
/
cache.plm
< prev
next >
Wrap
Text File
|
1999-03-24
|
4KB
|
133 lines
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- $_ if 0; # -*- perl -*-
# $Id: cache.plm,v 2.5 1999/01/31 10:07:05 hasegawa Exp $
# copyright (c)1999 Yoshinori Hasegawa <hasegawa@madoka.org>
package auto_cache;
$SIZE = 10;
$EXPIRE = 600;
$_ = 'auto_cache';
sub module_disable {
local($userno) = @_;
local($no, $chan);
foreach $key (keys(%cache)) {
($no, $chan) = split(/$;/, $key, 2);
next unless $'userno[$no] == $userno;
delete $cache{$key};
}
}
sub server_close {
local($serverno) = @_;
local($no, $chan);
foreach $key (keys(%cache)) {
($no, $chan) = split(/$;/, $key, 2);
next unless $no == $serverno;
delete $cache{$key};
}
}
sub ss_privmsg {
local($serverno, $prefix, $cmd, @params) = @_;
local($regex);
if (&'channel($params[0])) {
foreach $clear (&'property($'userno[$serverno], 'clear')) {
$regex = &'regex(&'jis_euc($clear));
next unless &'jis_euc($params[1]) =~ /$regex/;
$cache{$serverno, $params[0]} = '';
last;
}
}
return ($prefix, $cmd, @params);
}
sub sp_privmsg {
local($serverno, $prefix, $cmd, @params) = @_;
local(@list, $size, $key, $expire, $now, $time, $text);
if (&'channel($params[0])) {
$size = &'property($'userno[$serverno], 'size');
$size = $SIZE unless defined($size);
$key = $serverno . $; . $params[0];
@list = &'array($cache{$key});
while (@list > $size) {
shift(@list);
}
$expire = &'property($'userno[$serverno], 'expire');
$expire = $EXPIRE unless defined($expire);
$now = time();
foreach $line (@list) {
($time, $text) = split(/\:/, $line, 2);
next if ($expire != 0 && $time + $expire < $now);
return () if $text eq $params[1];
}
$cache{$key} = '' unless $cache{$key};
$cache{$key} .= &'list($now . ':' . $params[1]);
}
return ($prefix, $cmd, @params);
}
sub ss_part {
local($serverno, $prefix, $cmd, @params) = @_;
delete $cache{$serverno, $params[0]};
return ($prefix, $cmd, @params);
}
__END__
--><HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-2022-JP">
<LINK REV="made" HREF="mailto:hasegawa@madoka.org">
<TITLE>auto/cache.plm</TITLE></HEAD><BODY>
$B%*%s%i%$%s%I%-%e%a%s%H(B
<HR><H3>$BL>A0(B</H3>
auto/cache.plm - $BF1$8H/8@$r7+$jJV$5$J$$$h$&$K@)8B$9$k(B
<HR><H3>$B@bL@(B</H3>
$B2a5n$KH/8@$7$?J8;zNs$rJ]B8$7$F$*$-!"$=$NCf$KH/8@$7$h$&$H$7$F$$$k(B
$BJ8;zNs$,$"$l$P!"$=$l$rH/8@$7$J$$$h$&$K$7$^$9!#(B
<HR><H3>$B%W%m%Q%F%#(B</H3>
<DL>
<DT> auto.cache.size $B%-%c%C%7%e$NBg$-$5(B
</DT>
<DD> $BJ]B8$7$F$*$/H/8@?t$N?t$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$G$O(B10$B$K$J$C$F$$$^$9!#(B
</DD>
<DT> auto.cache.expire $B%-%c%C%7%e$NM-8z4|8B(B
</DT>
<DD> $B%-%c%C%7%e$,M-8z$J;~4V$r;XDj$7$^$9!#(B
$B$3$3$G;XDj$7$?IC?t$,7P2a$7$?%-%c%C%7%e$O<+F0E*$K%/%j%"$5$l$^$9!#(B
0$B$r;XDj$9$k$H!"%/%j%"$O9T$o$l$^$;$s!#(B
$B%G%U%)%k%H$G$O(B600$B$K$J$C$F$$$^$9!#(B
</DD>
<DT> auto.cache.clear* $B%-%c%C%7%e$r%/%j%"$9$kH/8@(B
</DT>
<DD> $B$3$3$G;XDj$7$?J8;zNs$rH/8@$9$k$H!"%-%c%C%7%e$r%/%j%"$7$^$9!#(B
</DD>
</DL>
<HR><H3>$B@_DjNc(B</H3>
<PRE>
+ auto/cache.plm
auto.cache.size: 5
auto.cache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