adding filter function for clear_cache and clear_data

#47 
- Add `filter_func` for `clear_cache()` and `clear_data()`.
- Four new test cases for new parameters.