You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Zohar <da...@hotmail.com> on 2008/03/03 16:21:49 UTC

Re: entry removal event

Thanks for your reply.
I implemented the IElementEventHandler interface, but I'm not sure which 
events I am interested in. What is the event (or events) which mean that my 
item's underlying file should be deleted?
Where can I find a detailed explanation of the events and their meaning 
(more detailed than the one in 
http://jakarta.apache.org/jcs/ElementEventHandling.html) - maybe I can find 
my answer there...

Thanks,
Zohar.

--------------------------------------------------
From: <da...@us.hsbc.com>
Sent: Friday, February 29, 2008 4:04 AM
To: "JCS Users List" <jc...@jakarta.apache.org>
Subject: Re: entry removal event

> Hi,
>
> IMHO, you can implement an IElementEventHandler, which can be trigger at
> certain events including cache timeout, and you can do your deleting files
> actions then.
>
>            rpqCache = JCS.getInstance(RPQ);
>
>            IElementEventHandler timeoutHandler = new
> RPQCacheTimeoutHandler();
>            IElementAttributes attrs =
> rpqCache.getDefaultElementAttributes();
>            attrs.addElementEventHandler(timeoutHandler);
>
> You may refer to JCS's official document. it has a chapter for element
> event handling. Hope it can help~
>
> Thanks & Regards
> David (HASE B2G, Ext 7859)
>
>
>
> "Zohar" <da...@hotmail.com>
> 02/28/2008 09:38 PM
> Mail Size: 5407
> Please respond to
> "JCS Users List" <jc...@jakarta.apache.org>
>
>
> To
> <jc...@jakarta.apache.org>
> cc
>
> Subject
> entry removal event
> Our Ref
>
> Your Ref
>
>
>
>
>
>
>
> Hello,
> I'm new to JCS, so please accept the usual grabble...
> I need to use JCS to cache data regarding files I use in my system. I
> don't think it's necessary to keep the files themselves in cache, just
> their path. When a file's cache entry is deleted (e.g., was used too long
> ago), I need to delete the underlying file itself. How do I do that?
> Thanks,
> Zohar.
>
> -----------------------------------------
> ******************************************************************
> This message originated from the Internet.  Its originator may or
> may not be who they claim to be and the information contained in
> the message and any attachments may or may not be accurate.
> ******************************************************************
>
>
> ************************************************************
> HSBC Software Development (Guangdong) Limited
> whose office address is
> 5/F Jie Tai Plaza, 218 - 222 Zhong Shan Liu Road, Guangzhou,
> The People's Republic of China
> ************************************************************
>
>
> -----------------------------------------
> *******************************************************************
> This e-mail is confidential. It may also be legally privileged.
> If you are not the addressee you may not copy, forward, disclose
> or use any part of it. If you have received this message in error,
> please delete it and all copies from your system and notify the
> sender immediately by return e-mail.
>
> Internet communications cannot be guaranteed to be timely,
> secure, error or virus-free. The sender does not accept liability
> for any errors or omissions.
> *******************************************************************
> "SAVE PAPER - THINK BEFORE YOU PRINT!" 


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: cache file corruption

Posted by Aaron Smuts <as...@yahoo.com>.
It looks like its happening during defragmentation.


--- Tim Cronin <tc...@interwoven.com> wrote:

> We've got a customer who has started seeing these
> issue.
> they say it's happening every few hours to their
> servers
> 
> we're still trying to track down what they might be
> doing.
> 
> 
> 2008-02-26 16:42:33,058 ERROR
>
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache]
> Region
> [component] Error occurred during defragmentation.
> java.io.IOException: Mismatched memory and disk
> length (829686271) for
> [DED:  pos = 122753 len = 923]
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDisk.move(IndexedDisk.java:
> 135)
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.defragFile(Indexe
> dDiskCache.java:1198)
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.optimizeFile(Inde
> xedDiskCache.java:1125)
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache$2.run(IndexedDisk
> Cache.java:1052)
>  at java.lang.Thread.run(Thread.java:595)
> 2008-02-26 16:42:33,308 WARN
> [org.apache.jcs.auxiliary.disk.indexed.IndexedDisk]
>  The file is corrupt:
>  Record [DED:  pos = 469507 len = 799] starts past
> EOF.
> 2008-02-26 16:42:33,308 ERROR
>
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache]
> Region
> [component] IO Exception, Problem reading object
> from file
> java.io.IOException: The File Is Corrupt, need to
> reset
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jcs-users-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


cache file corruption

Posted by Tim Cronin <tc...@interwoven.com>.
We've got a customer who has started seeing these issue.
they say it's happening every few hours to their servers

we're still trying to track down what they might be doing.


2008-02-26 16:42:33,058 ERROR
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache] Region
[component] Error occurred during defragmentation.
java.io.IOException: Mismatched memory and disk length (829686271) for
[DED:  pos = 122753 len = 923]
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDisk.move(IndexedDisk.java:
135)
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.defragFile(Indexe
dDiskCache.java:1198)
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.optimizeFile(Inde
xedDiskCache.java:1125)
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache$2.run(IndexedDisk
Cache.java:1052)
 at java.lang.Thread.run(Thread.java:595)
2008-02-26 16:42:33,308 WARN
[org.apache.jcs.auxiliary.disk.indexed.IndexedDisk]
 The file is corrupt:
 Record [DED:  pos = 469507 len = 799] starts past EOF.
2008-02-26 16:42:33,308 ERROR
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache] Region
[component] IO Exception, Problem reading object from file
java.io.IOException: The File Is Corrupt, need to reset

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: handling events

Posted by Thomas Vandahl <tv...@apache.org>.
Zohar wrote:
> CacheElement obj = (CacheElement) ((EventObject)event).getSource();
> 
> but it seems a bit ugly - doesn't it...?

Yep, but this is how it's done. Please note that the expiry event types 
that are supposed to be fired on access will not be generated in 1.3. 
See https://issues.apache.org/jira/browse/JCS-33 for the story. You'll 
need to roll your own from the code in SVN.

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: cache size limit

Posted by Aaron Smuts <as...@yahoo.com>.
You could extend the memory cache, use an object key
that your extension understands, and do it yourself. 
The cache is completely pluggable.  It would trivial
to do this.

Aaron


--- Zohar <da...@hotmail.com> wrote:

> Hello,
> I use JCS to cache entries which hold file paths.
> The underlying files are 
> kept in the file system. Is there any way I can
> impose a size limit on the 
> cache's "real impact" on the file system? For
> example, is there a way to 
> assign a 'size' attribute to a CacheElement, so that
> this attribute is used 
> when calculating the cache's size, instead of the
> entry's size?
> 
> Thanks,
> Zohar. 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jcs-users-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


cache size limit

Posted by Zohar <da...@hotmail.com>.
Hello,
I use JCS to cache entries which hold file paths. The underlying files are 
kept in the file system. Is there any way I can impose a size limit on the 
cache's "real impact" on the file system? For example, is there a way to 
assign a 'size' attribute to a CacheElement, so that this attribute is used 
when calculating the cache's size, instead of the entry's size?

Thanks,
Zohar. 


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


handling events

Posted by Zohar <da...@hotmail.com>.
Hi,
I've implemented the IElementEventHandler interface.
I now have :

public void handleElementEvent(IElementEvent event) {
    // handle event
}

How do I access the cached object in the event?
I managed to do it using:

CacheElement obj = (CacheElement) ((EventObject)event).getSource();

but it seems a bit ugly - doesn't it...?

Is there a better way?

Thanks,
Zohar. 

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org