Currently the cache is an in-memory binary tree. There is some information at http://www.owfs.org/index.php?page=cache
Several different things are cached:
1. devices (basically if a serial number was found, and on which bus)
2. directory lists (lists of serial numbers for a given path)
3. "file" contents ( things like serialnumber/temperature )
4. Hidden properties (like cumulative counters, and barometer calibration factors)
Cached items also store their termination time.
We actually use two binary trees, one for new entries, and one that is older. The older one doesn't get updated, and eventually expires entirely, and gets deleted. At that point, the newer one becomes the older one, and a new one is started.
This means that we never have to scan through all the items with see which are too old, and stale entries are guarnteed to be deleted in a reasonable time period.
So, could the cache be stored in SQLite? Sure. Could it be backed up by a physical file? Sure. What would the advantage be? Binary trees are quite fast for adding and retrieving. Glibc and uClibc both have support built in for binary trees so external libraries are needed.
There are some problems with the current scheme. If you have owfs connecting to owserver, each has it's own cache. It is possible for the caches to be out of synch, especially if several programs are connected to owserver. Reading "uncached" values will always work, and cache problems time themselves out quickly in any case.
An alternative design would be a separate owcache program. Cache would be consistent, and not repeated, but communication efficiency might swamp space efficiency. I didn't do it because of the complexity.
Tell me what you see as the deficiencies of the current scheme.
Paul Alfille
On 10/14/06, Roberto Spadim <[EMAIL PROTECTED]> wrote:
Hello guys, i was thinking about cache system...
can we use cache in filesystem?
like in sqlite we can use
sqlite_open(":memory:");
to use database on memory and
sqlite_open("/file.sqlite");
to open an file
could we set the "file_name" of cache system?
if we put "NULL" the cache system could be turned off
what you say?
have anyother database system that is fast than today database? sqlite
could be used? we are using berkley?
could we select "file_name" for
Old Cache data
New Cache data
Persistent data
in diferent "files"??
thankx guys :)
"files" could be memory or real file
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/owfs-developers