Thanks james for good ideas,about pool and cache discuss is infrequently.
 it can say:
    Object pooling is exclusive access.
    pooled Object is not thread safe
and cache is reverse .
But the jcs support muti thread access,Is jcs cache object required  thread safe ?






> Sadly, there are no hard rules since people use them interchangeably
> (like OracleConnectionCacheImpl which implements a connection pool) but
> here is my take:
> 
> Object pooling is for the most part used to reduce the cost of creating
> expensive objects. In a pool you generally have a bunch of the same
> object, all of which are returned to the client with the same state (for
> example, a connection pool always gives you a connection to a given data
> source, a string buffer pool always gives you a string buffer with
> length zero, ...). Generally pool policy is that you request an object
> and get exclusive access to it until you release it.
> 
> Caching is for keeping objects with specific state associated with a
> key. When you cache and object with a given key, you get back the same
> object. This is not always strictly true because the object might have
> been serialized and unserialized, but the point is that the cache does
> not ensure that you get exclusive access.
> 
> So, if that makes any sense, pooling is great for reusing expensive to
> create objects which are not thread safe, caching is great for holding
> data objects which are thread safe and serializable. 
> 
> I tried =]
> 
> -- jt
> 
> On Fri, 2002-08-30 at 01:43, yangjs wrote:
> > 
> > hi,
> >    I'm puzzled between "cache system" and "pool system", anyone can tell me how to 
>distinguish them.
> > 
> > 



Reply via email to