cache the serialization of a Key

This will speed up the common case where a Key is deserialized from
disk, but is then serialized to build eg, the path to the annex object.

It means that every place a Key has any of its fields changed, the cache
has to be dropped. I've grepped and found them all. But, it would be
better to avoid that gotcha somehow..
This commit is contained in:
Joey Hess 2019-01-14 16:33:20 -04:00
parent 918868915c
commit 4536c93bb2
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 34 additions and 7 deletions

View file

@ -23,6 +23,7 @@ data Key = Key
, keyMtime :: Maybe EpochTime
, keyChunkSize :: Maybe Integer
, keyChunkNum :: Maybe Integer
, keySerialization :: Maybe S.ByteString -- ^ cached serialization
} deriving (Eq, Ord, Read, Show)
{- A filename may be associated with a Key. -}