Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cach does not updates data after "put" action #262

Open
ctasci opened this issue Jul 11, 2017 · 1 comment
Open

Cach does not updates data after "put" action #262

ctasci opened this issue Jul 11, 2017 · 1 comment

Comments

@ctasci
Copy link

ctasci commented Jul 11, 2017

Hi,
i am using http requests and custom cache objects to handle the caching.
i have a list of customer. if i do a "put" action after i inserted a customer into my db the cache is not updating/it. if i now refresh the site or "removeAll" from my custom cache object it is holding the data.

here's how i create my custom cache-object if (!CacheFactory.get('customerCache')) { customerCache = CacheFactory('customerCache', { maxAge: 15 * 60 * 1000, // Items added to this cache expire after 15 minutes cacheFlushInterval: 60 * 60 * 1000, // This cache will clear itself every hour deleteOnExpire: 'aggressive' // Items will be deleted from this cache when they expire }); } else { customerCache = CacheFactory.get('customerCache'); } this is how i do the put action:
`var customerCache = CacheFactory.get('customerCache');

            var deferred = $q.defer();
            $http.post('/Umbraco/Api/CustomerWebApi/publishCustomer', angular.toJson(customer), {
                cache: customerCache
            }).success(function (data) {
                debugger
                if (data.cError.OK == true) {
                    customerCache.put(data.customer.id, data.customer);
                }
                deferred.resolve(data);
            });
            return deferred.promise;`

and here how i get my list:
var customerCache = CacheFactory.get('customerCache'); var deferred = $q.defer(); var start = new Date().getTime(); debugger $http.get('/Umbraco/Api/CustomerWebApi/getAllCustomerByUser', { cache: customerCache }).success(function (data) { console.log('time taken for request: ' + (new Date().getTime() - start) + 'ms'); deferred.resolve(data); }); return deferred.promise;
Why is the new inserted data not (visible) in the cach-object ?

@MatheusArleson
Copy link

there is an issue in how the cache is handled in case it is an array.
please take a look on my comment on #251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants