SkillAgentSearch skills...

Filecache

A Linux-only cache system associating values to files. The values are automatically discarded when the files are modified.

Install / Use

/learn @bartavelle/Filecache
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

filecache

Hackage Haskell-CI

A multi-platform (Linux, Mac, Windows) cache system associating values to files. The values are automatically discarded when the files are modified.

Example usage:

module Main where

import Data.FileCache

countlines :: FilePath -> IO (Either String Int)
countlines = fmap (Right . length . lines) . readFile

main :: IO ()
main = do
    cache <- newFileCache :: IO (FileCache Int)
    let countlines' p = lazyQuery cache p (countlines p)
    countlines' "/tmp/somefile" >>= print

This should either print Left "/tmp/somefile: openFile: does not exist (No such file or directory)" or Right n, where n is the line count.

Subsequent calls to countlines' will read the data from the cache if the file hasn't been modified, or will run the original computation again.

View on GitHub
GitHub Stars5
CategoryDevelopment
Updated2mo ago
Forks3

Languages

Haskell

Security Score

85/100

Audited on Jan 19, 2026

No findings