diff --git a/README.md b/README.md index 9b375e7..dfcc025 100644 --- a/README.md +++ b/README.md @@ -71,4 +71,9 @@ cache = the main feature of this module is automated and organized caching, you ``` ### Extras -The source code is similar to the django-rest-framework's generic classes and related objects, it should be eminently readable. A new method is added in each filter named get_unique_dict that aids in fixing the duplicate key problem. +The source code is similar to the django-rest-framework's generic classes and related objects, it should be eminently readable. As with the rest framework's generics multiple inheritance is used through mixing to organize the behavior of each class in a standalone setting. + +# Duplicate Cache Keys Problem +The problem arises in the way cache keys are created, the naive method is to just use the information from the url of the request and just save it to the cache. This creates a problem in that a request such as https://example.com/api/v1/pictures/search?search=mypic&category=mycat and a request https://example.com/api/v1/pictures/search?category=mycat&search=mypic contain the same information in their cache values. So the order of each filter or the order within the filters (such as the facet filter I made for e-commerce APIs) affects the caching behavior and creates more work for our APIs. + +The way this module fixes the duplicate cache keys problem is by systematically ordering the filters through each filter's get_unique_dict method that are called in cache_mixins.py and then running the sorted_params_string utility function in the resulting dict.