The ICacheController interface only has a few members to it. I didn't see 
anything in the MemcachedClient about removing multiple keys. 

I haven't tested the code below but I'm able to run the MemcachedBench program 
against a win32 build of memcached:

 http://jehiah.com/projects/memcached-win32/

I think the ICacheController should have a Shutdown member so 3rd party caches 
can clean up when the application shutsdown.

Of course all the properties on the pool object should be settable by
the properties argument. The properties argument should also have a key
to prefix items put into the cache so IBatisNet plays nice with other
programs using the cache. It should be possible to also integrate the 
FlushInterval construct into this implementation.

// untested - inspired by Memcached.MemcachedBench.MemcachedBench
public class MemcachedCacheController : ICacheController
{
 private SockIOPool pool;
 private MemcachedClient memcachedClient;

 public object this[object key]
 {
  get { return memcachedClient.Get(Convert.ToString(key)); }
  set { memcachedClient.Set(Convert.ToString(key), value); }
 }

 public object Remove(object key)
 {
  return memcachedClient.Delete(Convert.ToString(key));
 }

 public void Flush()
 {
  // empty
 }

 public void Configure(IDictionary properties)
 {
  string servers = Convert.ToString(properties["server"]);

  pool = SockIOPool.GetInstance();
  pool.SetServers(servers.Split(','));
  pool.InitConnections = 3;
  pool.MinConnections = 3;
  pool.MaxConnections = 5;
  pool.SocketConnectTimeout = 1000;
  pool.SocketTimeout = 3000;
  pool.MaintenanceSleep = 30;
  pool.Failover = true;
  pool.Nagle = false;
  pool.Initialize();

  memcachedClient = new MemcachedClient();
  memcachedClient.EnableCompression = false;
 }
}

----- Original Message ----
From: Alexandre Grenier <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, October 6, 2006 2:51:41 PM
Subject: RE: distributed cahing/iBATIS.Net


I've done some fooling around with memcached... I still haven't looked into how 
to write a custom cache provider for ibatis though. If no one's done it by the 
time I get there, then I'll probably do it :)

Alex


-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 05, 2006 7:22 PM
To: [email protected]
Subject: Re: distributed cahing/iBATIS.Net


Someone needs to write an IBatisNet cache client for memcached:

 http://www.danga.com/memcached/

There is a closed source solution called NCache but its probably $$$.


----- Original Message ----

From: Tite Etoundi <[EMAIL PROTECTED]>

To: [email protected]

Sent: Tuesday, October 3, 2006 7:27:27 PM

Subject: distributed cahing/iBATIS.Net



Hi evry body,



I am new in using iBATIS as a data mapper in the project. But it works well. It 
allow me to have a better architecture of my application so it isolates 
correctly the data access. But my concern about it is distributed caching. Does 
iBATIS allows this kind of stuff or is there an open source solution that can 
be used with iBATIS like OSCache for iBATIS java?



Thank          

  Découvrez un nouveau moyen de poser toutes vos questions quel que soit le 
sujet !  Yahoo! Questions/Réponses pour partager vos connaissances, vos 
opinions et vos expériences. Cliquez ici.  










Reply via email to