Permalink
Browse files

Merge pull request #1 from ischyrus/master

Better messages including key's loaded
  • Loading branch information...
2 parents 40c860e + 288f68a commit d7f646a7240419b36fcb91f299e37d282766867a @ibdknox committed Jul 28, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/simpledb/core.clj
View
11 src/simpledb/core.clj
@@ -27,19 +27,20 @@
(defn persist-db []
(let [cur @*db*]
- (println "Persisting " (count cur) " keys.")
+ (println "SimpleDB: Persisting " (count cur) " keys.")
(spit "./sdb.db" (pr-str cur))))
(defn read-db []
(let [content (try
(read-string (slurp "./sdb.db"))
(catch Exception e
- (println "Could not find a sdb.db file. Starting from scratch")
+ (println "SimpleDB: Could not find a sdb.db file. Starting from scratch")
{}))]
(reset! *db* content)
- (if (seq content)
- true
- nil)))
+ (let [not-empty? (complement empty?)]
+ (when (not-empty? content)
+ (println "SimpleDB: " (count content) " keys are loaded.")
+ true))))
(defn clear! []
(reset! *db* {})

0 comments on commit d7f646a

Please sign in to comment.