def get_set_cache(key, data_func, timeout=15):
    """
    Used for putting data in cache .. specified on a timeout
    :param key:
    :type string:
    :param data:
    :type queryset result:
    :param timeout:
    :type int:
    """
    result = Cache.get(key)
    if result is None:
        if data_func is None:
            raise
        if not hasattr(data_func, "__call__"):
            result = data_func
        else:
            result = data_func()
        Cache.set(key, result, timeout)
    return result
    def obj_get_list(self, bundle, **kwargs):
        self.is_authenticated(bundle.request)
        filters = {}
        params = {}
        if hasattr(bundle.request, "GET"):
            params = bundle.request.GET.copy()
        dtstart = params.get("created_date__gte")
        dtend = params.get("created_date__lte")
        hash_key = "gm-feeds-status1-"
        if dtstart:
            filters["created_date__gte"] = dtstart
            hash_key = hash_key + dtstart
        if dtend:
            filters["created_date__lte"] = dtend
            hash_key = hash_key + dtend

        data_map = {}
        result = []
        filters["feed_type__in"] = FEED_SENT_TYPES + FEED_TYPES

        output = Cache.get(hash_key)
        if output:
            return map(CustomApiObject, output)

        objects = models.DataFeedLog.objects.filter(**filters)

        for feed_type in FEED_SENT_TYPES + FEED_TYPES:
            data_map[feed_type] = [0, 0]
        for obj in objects:
            feed_counts = data_map[obj.feed_type]
            feed_counts[0] = feed_counts[0] + int(obj.failed_data_count)
            feed_counts[1] = feed_counts[1] + int(obj.success_data_count)
            data_map[obj.feed_type] = feed_counts

        for key, value in data_map.items():
            action = FeedStatus.RECEIVED
            if key in FEED_SENT_TYPES:
                action = FeedStatus.SENT
            result.append(create_feed_dict([action, key, value[1], value[0]]))
        Cache.set(hash_key, result, 15 * 60)
        return map(CustomApiObject, result)