Java Doc for MemoryStoreTC.java in  » Net » Terracotta » net » sf » ehcache » store » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Terracotta » net.sf.ehcache.store 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sf.ehcache.store.MemoryStoreTC

MemoryStoreTC
abstract public class MemoryStoreTC implements Store(Code)
An abstract class for the Memory Stores. All Memory store implementations for different policies (e.g: FIFO, LFU, LRU, etc.) should extend this class.
author:
   Surya Suravarapu
version:
   $Id: MemoryStoreTC.java 5280 2007-08-27 18:23:11Z asi $


Field Summary
protected  Ehcachecache
     The cache this store is associated with.
final protected  DiskStorediskStore
     The DiskStore associated with this MemoryStore.
protected  Mapmap
     Map where items are stored by key.
protected  Statusstatus
     status.

Constructor Summary
protected  MemoryStoreTC(Ehcache cache, Store diskStore)
     Constructs things that all MemoryStores have in common.

Method Summary
final protected  voidclear()
     Clears any data structures and places it back to its state when it was first created.
final public  booleancontainsKey(Object key)
     An unsynchronized check to see if a key is in the Store.
public static  MemoryStorecreate(Ehcache cache, Store diskStore)
     A factory method to create a MemoryStore.
final public synchronized  voiddispose()
     Prepares for shutdown.
protected  voiddoPut(Element element)
     Allow specialised actions over adding the element to the map.
final protected  voidevict(Element element)
     Evict the Element.
final public synchronized  voidflush()
     Flush to disk.
final public synchronized  Elementget(Object key)
     Gets an item from the cache.
final public synchronized  Object[]getKeyArray()
     Gets an Array of the keys for all elements in the memory cache.
final public synchronized  ElementgetQuiet(Object key)
     Gets an item from the cache, without updating Element statistics.
final public  intgetSize()
     Returns the current cache size.
final public synchronized  longgetSizeInBytes()
     Measures the size of the memory store by measuring the serialized size of all elements.
final public  StatusgetStatus()
     Gets the status of the MemoryStore.
final protected  booleanisFull()
     An algorithm to tell if the MemoryStore is at or beyond its carrying capacity.
final protected  voidnotifyExpiry(Element element)
     Before eviction elements are checked.
final public synchronized  voidput(Element element)
     Puts an item in the cache.
final public synchronized  Elementremove(Object key)
     Removes an Element from the store.
final public synchronized  voidremoveAll()
     Remove all of the elements from the store.
final protected  voidspoolAllToDisk()
     Spools all elements to disk, in preparation for shutdown.
final protected  voidspoolToDisk(Element element)
     Puts the element in the DiskStore.

Field Detail
cache
protected Ehcache cache(Code)
The cache this store is associated with.



diskStore
final protected DiskStore diskStore(Code)
The DiskStore associated with this MemoryStore.



map
protected Map map(Code)
Map where items are stored by key.



status
protected Status status(Code)
status.




Constructor Detail
MemoryStoreTC
protected MemoryStoreTC(Ehcache cache, Store diskStore)(Code)
Constructs things that all MemoryStores have in common.
Parameters:
  cache -
Parameters:
  diskStore -




Method Detail
clear
final protected void clear()(Code)
Clears any data structures and places it back to its state when it was first created.



containsKey
final public boolean containsKey(Object key)(Code)
An unsynchronized check to see if a key is in the Store. No check is made to see if the Element is expired.
Parameters:
  key - The Element key true if found. If this method return false, it means that an Element with the given key is definitely notin the MemoryStore. If it returns true, there is an Element there. An attempt to get it may return null ifthe Element has expired.



create
public static MemoryStore create(Ehcache cache, Store diskStore)(Code)
A factory method to create a MemoryStore.
Parameters:
  cache -
Parameters:
  diskStore - an instance of a MemoryStore, configured with the appropriate eviction policy



dispose
final public synchronized void dispose()(Code)
Prepares for shutdown.



doPut
protected void doPut(Element element) throws CacheException(Code)
Allow specialised actions over adding the element to the map.
Parameters:
  element -



evict
final protected void evict(Element element) throws CacheException(Code)
Evict the Element.

Evict means that the Element is:

  • if, the store is diskPersistent, the Element is spooled to the DiskStore
  • if not, the Element is removed.

Parameters:
  element - the Element to be evicted.



flush
final public synchronized void flush()(Code)
Flush to disk.



get
final public synchronized Element get(Object key)(Code)
Gets an item from the cache.

The last access time in net.sf.ehcache.Element is updated.
Parameters:
  key - the cache key the element, or null if there was no match for the key




getKeyArray
final public synchronized Object[] getKeyArray()(Code)
Gets an Array of the keys for all elements in the memory cache.

Does not check for expired entries An Object[]




getQuiet
final public synchronized Element getQuiet(Object key)(Code)
Gets an item from the cache, without updating Element statistics.
Parameters:
  key - the cache key the element, or null if there was no match for the key



getSize
final public int getSize()(Code)
Returns the current cache size. The size value



getSizeInBytes
final public synchronized long getSizeInBytes() throws CacheException(Code)
Measures the size of the memory store by measuring the serialized size of all elements. If the objects are not Serializable they count as 0.

Warning: This method can be very expensive to run. Allow approximately 1 second per 1MB of entries. Running this method could create liveness problems because the object lock is held for a long period the size, in bytes




getStatus
final public Status getStatus()(Code)
Gets the status of the MemoryStore.



isFull
final protected boolean isFull()(Code)
An algorithm to tell if the MemoryStore is at or beyond its carrying capacity.



notifyExpiry
final protected void notifyExpiry(Element element)(Code)
Before eviction elements are checked.
Parameters:
  element -



put
final public synchronized void put(Element element) throws CacheException(Code)
Puts an item in the cache. Note that this automatically results in net.sf.ehcache.store.LruMemoryStore.SpoolingLinkedHashMap.removeEldestEntry being called.
Parameters:
  element - the element to add



remove
final public synchronized Element remove(Object key)(Code)
Removes an Element from the store.
Parameters:
  key - the key of the Element, usually a String the Element if one was found, else null



removeAll
final public synchronized void removeAll() throws CacheException(Code)
Remove all of the elements from the store.



spoolAllToDisk
final protected void spoolAllToDisk()(Code)
Spools all elements to disk, in preparation for shutdown.

Relies on being called from a synchronized method

This revised implementation is a little slower but avoids using increased memory during the method.




spoolToDisk
final protected void spoolToDisk(Element element)(Code)
Puts the element in the DiskStore. Should only be called if Ehcache.isOverflowToDisk is true

Relies on being called from a synchronized method
Parameters:
  element - The Element




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.