]> git.lizzy.rs Git - go-anidb.git/commit
anidb: (*cacheDir).Get(): reduce the time a file lock is retained
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Sun, 14 Jul 2013 05:04:35 +0000 (02:04 -0300)
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Sun, 14 Jul 2013 05:04:35 +0000 (02:04 -0300)
commit1df9be9873b9ea080906a30c5eaa5bfe97d173e3
tree9e9de2c1a5bf25dcbe880bf31a682a1d44591b8d
parent2f8683fd5f65a1641fff26502383b8f201257f12
anidb: (*cacheDir).Get(): reduce the time a file lock is retained

When reading from cache, read the entire file into a buffer before
attempting to decode; release the lock as soon as the read is done.

Also move the parameter sanity check to be earlier in the method.
cache.go