Browse Source

cleaned up old cache proedure and renamed it to cache categories only

master
Wesley Kerfoot 12 years ago
parent
commit
dcbeb8aa09
  1. 13
      cacher.rkt

13
cacher.rkt

@ -37,24 +37,15 @@
[#f #f] [#f #f]
[_ (hash-ref obj 'content)])) [_ (hash-ref obj 'content)]))
cached?)) cached?))
;; type is the type of data to cache (define (cache-category info get-data)
;; info is the actual name of the data to be cached
;; get-data is the proc that gets the data from the database
(define (cache info type get-data)
(match type
['user
(let* ([message (make-hash)] (let* ([message (make-hash)]
[data (get-data)]) [data (get-data)])
(hash-set! message '_id info) (hash-set! message '_id info)
(hash-set! message 'content data) (hash-set! message 'content data)
(hash-set! message 'last_updated (current-inexact-milliseconds)) (hash-set! message 'last_updated (current-inexact-milliseconds))
(couchdb-put conn message) (couchdb-put conn message)
data)])) data))
(define (cache-user message username page-num get-data) (define (cache-user message username page-num get-data)
(let ([data (get-data)]) (let ([data (get-data)])