stxnext-kindergarten/presence-analyzer-lkoczwara — pull request #8 by lukaszkoczwara (2013-12-17 11:03:52+00:00)
Title: Caching 929

### caching 929

In order to increase the performance of application, caching decorator was introduced for `get_data()` function. Decorator will cache data after csv parsing for certain amount of seconds. Decorator can get amount of seconds as an argument.

Implementation is prepared for multithreaded environment due to used `lock` mechanism in decorator.

Scope of this pull request:

- implemented caching decorator
- reimplemented decorator to be a `class`
- moved all application decorators to separate module
- attempt to mock decorated functions (failed)
- attempt to work with `venusian` to properly test decorated functions (not worth effort)
- used environment variables (additional recipe set in `buildout` just for tests) to fool decorators
when running tests

Tests:

- no test added
- coverage:
```
Name Stmts Miss Cover Missing
------------------------------------------------------------
presence_analyzer 3 0 100%
presence_analyzer.decorators 28 8 71% 34-41
presence_analyzer.helpers 23 0 100%
presence_analyzer.main 3 0 100%
presence_analyzer.utils 39 0 100%
presence_analyzer.views 47 0 100%
------------------------------------------------------------
TOTAL 143 8 94%
----------------------------------------------------------------------
Ran 18 tests in 0.162s

```
Usage:

- run app: `$ ./bin/flask-ctl debug fg`

Gist:

- no pep8 issues