The function Model_Whatever::find_by_id_and_user_id() is apparently accessing the database via ORM to find the object with the given id and userid. My question is, does the ORM use some sort of cache so the same query executed twice will only count as one access to the database? If I use find_by_id_and_user_id() twice in the same function will it access the db twice? If so, should I just store the value as a variable so I can reuse it or is there some function in fuel that already caches these database queries?
If you use Model::find($id) it won't be fetched twice, when done like your example it will be fetched again. That is because when using find() with a primary key value it checks whether it was fetched already. But when using Model::find_by_id($id) that really means Model::query()->where('id', $id)->get(), which is just querying and those aren't checked (though a tiny bit of memory is saved after fetching from the DB during hydration, there will be only one instance in memory of the object).