Opened 10 years ago

Closed 10 years ago

#14023 closed defect (invalid) has different return values on get()

Reported by: Hounddog Owned by: Kris Zyp
Priority: high Milestone: tbd
Component: Data Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:


While doing a get to the for an object that is not loaded yet, the cache store uses the to query the server and returns a deferred. If the Object was already loaded the cache takes it from the and returns the item object.

The simplest solution would probably be to create a deferred for both so that you can just use the result in the callback.

var memory = new{});
var rest = new{
               target: '/xyz'
var cache =  new

cache.get(2);// First call will return a deferred item
cache.get(2);// Second call will deliver an object

Change History (1)

comment:1 Changed 10 years ago by ben hockey

Resolution: invalid
Status: newclosed

this is why dojo.when exists. see

dojo.when(cache.get(2), function (item) {
  // item is item with id of 2 every time
Note: See TracTickets for help on using tickets.