Forum Academy Marketplace Showcase Pricing Features

Caching database requests

I read somewhere but can’t verify that Bubble caches identical database requests so they aren’t repeated on the server. For instance:

current user's friends_list:count>0

Can I use this several times to style something on the page or should I set a state on the page once and then refer to that instead?


I don’t trust it now the WU update happened so will sometimes use hidden variables just in case, but Bubble insists it isn’t necessary (and I’m 99.9% sure they’re right but don’t want to risk the cost of being wrong!)

Good answer. Thanks George.

What happens when the query is changed ever so slightly, such as:

  1. current user's friends_list:count=0
  2. `current user’s friends_list’s each_item’s first_name
  3. etc.

Are these considered unique, and thus count against WU? What triggers a new search vs not?

Yes they should be in most cases but you should really just test and experiment because like three people on this entire forum understand WU and I’m not one of them

@2706mason Yes those are unique, #1 just an aggregate search returning a number

#2 is actually fetching fields/data. After this search all the friends_list’s data is cached on page.

I am not entirely sure but it’s possible addition searches after this will still cost a tiny bit of WUs, but the actual data fetching will not cost anything because it was already done the first time.

Just noticed you are not doing a search here, so I’m pretty sure after fetching data for all the friends_list fields the first time it doesn’t cost anything after that then. Just by referencing :each item’s first name it will grab all fields and data (just how Bubble is right now)