Database Related Modules Overview ML driver needs to hold some data on mail. Some data exixsts persistently but some data with expiration (data is discarded after some interval). An example of permisistent data is thread database. The latter case, an exapmle of non persistent data, is message-id cache. The thread database also has message-id cache in it, which is a sub-set of all message-id set of incoming messages. We handle these two data separately. We should handle these data in integrated way. module A ---| A |--- persistent database module B ---| da | module C ---| pt | modlue D ---| er |--- cache with expiration An example of this persistent DB, thread DB, is Mail::Message::DB class. Examples of cache database are Tie::JournaledDir and FML::Cache::Ring classes. It is better to use RDBMS for important persistent data such as address list. This chapter describes persistent data handling only for &fml8; internal use. Persistent Data Use Handling of persistent data is important. We should consider use of DBMS DBMS = DataBase Management System for important data. This chapter describes only &fml8; internal use. &fml8; provides two type of cache databases. The type is time saving or space saving. Tie::JournaledFile Class This class appends data into a file. Tie::JournaledFile class provides this function. This class is append only. It is similar to LFS (Log Structured File System). Operation to extract a value is to get the latest (last appended) value. That is, the last match. In other words, data cache logs all data to enable back track. We cannot restrict the maximum size of this cache. This class holds data within some period without size limitation. We control cache expiration by time. To get the following structure as a result, you can use get_all_values_as_hash_ref() method. key => [ log1 (line A of file 1), log2 (line B of file 2), log2 (line C of file 3), ] Search algorithm is either of first match or last match. The last match by default since the last appended data is latest. FML::Cache::Ring Class FML::Cache::Ring holds data with size limit but without time limitation. It is suitable for debug since the debug data is expected not to eat disk. This class holds data in files in a directory such as $ml_home_dir/var/db/. For example, files named as db/1 .. db/100 are created. These files are used repeatedly. RingBuffer class is integrated into FML::Cache::Ring class. FML::Cache::Ring is derived from File::CacheDir class.