markwatkinson / luminous

Accurate and powerful syntax highlighting library
http://luminous.asgaard.co.uk
GNU Lesser General Public License v2.1
51 stars 5 forks source link

Proposal: option to store cache in SQL #10

Closed markwatkinson closed 13 years ago

markwatkinson commented 13 years ago

It would be nice if the cache could use an SQL database instead of the filesystem.

Rationale: The cache currently stores one highlight per file on the filesystem. In some setups this could potentially lead to the cache directory containing thousands and thousands of tiny files, which might cause problems on some filesystems (running out of inodes), particularly if they were formatted without expecting this to occur. In any case, it seems neater to put it all in a database if there's one available.

Caveats: there's SQL beyond MySQL. This should support at least MySQL and Postgresql. PHP might have some abstract interface but I've never noticed one before.

edit: it might be best to implement this by callback functions and have the user define a function which actually sends the SQL to their database.