freetds cache
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <1214742116.7389.13.camel@freddy> |
Hi, I'm just thinking about caching for auto discoveries and port instances. Our implementation for protocol discovery require fail&try in order to get correct protocol while instance detect require a query to server for every connection. A good way to avoid these extra round-trips is to cache somewhere. The cache should be a lookup table with - ip of server (we don't want to cache even dns...) - port or instance - real port (for instance) - last protocol version - a "last time" for cleanup and updates this in order to do ip+port -> version and ip+instance -> version+port lookups. All seems fine and easy however: - where should we store this cache?? $HOME/.freetds.cache is ok? The worst case is PHP with Apache, is $HOME/.freetds.cache writable? should we add an additional configuration to store the path? - how to implement the cache, in a binary way or in a character format?? this cache is updated and used not by human but being readable is not that bad... however we need to be able to read it by many processes while some process should also update it and this require file locking for every update. Using binary could lead to single record locking but is more difficult to implement and not human readable. A trick would be to update the last time if quite old (say one week) and delete record if very old (say 1 month). Also we should consider that using binary way we can use trees or other lockup optimizations. We could use libdb but we would add an additional dependency just for an optimization. freddy77 _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds