https://discord.umbraco.com logo
What is the best way to get a Member in
# package-development
i
What is the best way to get a Member in code, that doesn't hit the database? I've looked at memberManager.FindByIdAsync() but under the hood this uses the memberService. I was looking for something like the IPublishedContentQuery that is more cache based, am I missing something here?
s
There is no member cache.. not sure how you expect to create a member without it being stored in the db?
oh, get, not create! but still there is no member cache
i
Yeah, it was more the Get side of things. Our site is a bit "chatty" and we create members in code, have SavedHandlers etc, and we're seeing some database scope issues, when creating a new member. But if there aren't any "cached" Get endpoints to hit, we'll have to think of something else
s
Think there's some kind of minimal repository cache, but nothing you should count on -- if you need to then you can just throw it in the RuntimeCache for a few minutes, or longer if you want to invalidate the caches individually. Are you working on a package? Sounds like v13? SavedHandler no longer exists in v17. Think this might be more of an #1443515195891646537 question, not a package question?
i
Yeah, its a more general umbraco chat sorry. This is V17 so what i call a SavedHandler i really mean SavedNotification 😆 I'm going to look into a simple Examine search for members, as in most cases we dont actually need the full member model, just a property or 2
But thanks for clarifying
s
All good! And yeah, hard to keep track of old and new terminologyh 😉
Actually I see now there is already a MembersIndex! Might be enough.
5 Views