Stanford-Online/class2go — pull request #1937 by sefk (2013-01-18 05:00:07+00:00)
Title: use dictionary.get() in cachestats (#1921)

based on feedback from @jbau in code review, small little improvement.

tested by setting ```CACHE_STATS_INTERVAL = 10``` in database.py. See log.

```
[17/Jan/2013 20:56:08] "GET /db/Winter2013/videos HTTP/1.1" 302 0
[17/Jan/2013 20:56:08] "GET /db/Winter2013 HTTP/1.1" 200 11473
[17/Jan/2013 20:56:12] "GET /accounts/login?next=/db/Winter2013 HTTP/1.1" 200 5958
[17/Jan/2013 20:56:17] "POST /accounts/login?next=/db/Winter2013 HTTP/1.1" 302 0
[17/Jan/2013 20:56:18] "GET /db/Winter2013 HTTP/1.1" 200 11237
INFO cache stats for video_store: hits 0, misses 1, rate 0.0
INFO cache stats for video_store: hits 0, misses 19, rate 0.0
INFO cache stats for file_store: hits 0, misses 71, rate 0.0
INFO cache stats for video_store: hits 0, misses 15, rate 0.0
INFO cache stats for file_store: hits 0, misses 67, rate 0.0
INFO cache stats for video_store: hits 0, misses 18, rate 0.0
INFO cache stats for file_store: hits 0, misses 75, rate 0.0
[17/Jan/2013 20:56:57] "GET /db/Winter2013/videos HTTP/1.1" 200 212524
[17/Jan/2013 20:57:03] "GET /db/Winter2013/materials/234 HTTP/1.1" 200 25512
INFO cache stats for video_store: hits 3, misses 5, rate 37.5
INFO cache stats for file_store: hits 10, misses 27, rate 27.0
[17/Jan/2013 20:57:17] "GET /db/Winter2013/videos HTTP/1.1" 200 212478
[17/Jan/2013 20:57:23] "GET /db/Winter2013/problemsets HTTP/1.1" 200 104315
[17/Jan/2013 20:57:26] "GET /db/Winter2013/videos HTTP/1.1" 200 212512
[17/Jan/2013 20:57:30] "GET /db/Winter2013/interactive_exercises HTTP/1.1" 200 55552
[17/Jan/2013 20:57:44] "GET /db/Winter2013/problemsets HTTP/1.1" 200 104315
INFO cache stats for video_store: hits 116, misses 0, rate 100.0
INFO cache stats for file_store: hits 480, misses 0, rate 100.0
[17/Jan/2013 20:57:47] "GET /db/Winter2013/videos HTTP/1.1" 200 212480
```