You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get the cache of the data object
I hope to add a cache to these two steps, and finally return the merged data to the front end. The code is as follows, but it does not seem to be effective
@Resolver(()=>Property)classPropertyOperatorResolver{
@resolverCache("property_image_translation")asyncget_image_translation(image){// get image translation info}
@resolverCache("property_image")asyncget_property_image(property_id){// get image data from db}
@FieldResolver()asyncimage(@Root()root: Property, @Ctx()context: Context){constproperty_image=awaitget_property_image(root.id);returnawaitget_image_translation(property_image);}}
So is it because there are restrictions on the decorator of typeGraphql? Is there any way to achieve my needs?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a requirement:
I hope to add a cache to these two steps, and finally return the merged data to the front end. The code is as follows, but it does not seem to be effective
So is it because there are restrictions on the decorator of typeGraphql? Is there any way to achieve my needs?
Beta Was this translation helpful? Give feedback.
All reactions