• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: invalidate relationship cache
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: invalidate relationship cache


  • Subject: Re: invalidate relationship cache
  • From: Aaron Rosenzweig <email@hidden>
  • Date: Mon, 05 Mar 2018 14:40:30 -0500

Hi André and Chuck,

I asked my wife about invalidating the relationship cache.

She looked at me and said:

“Love is grand, divorce is 100 grand”

I would:

1) create a fetch specification

2) set “refreshesRefetchedObjects()” to true.

3) set up a prefetch path that traverses to the second objects.

Then use the editing context to fetch.

EOQualifier identityQualifier = {set this up yourself}
EOFetchSpecification fetchSpec = new EOFetchSpecification(YourEO.ENTITY_NAME,
identityQualifier, null /*sortOrderings*/);
fetchSpec.setRefreshesRefetchedObjects(true);
fetchSpec.setPrefetchingRelationshipKeyPaths(new NSArray<String>(
                YourEO.RELATIONSHIP_NAME.dot(OtherEO.RELATIONSHIP_NAME).key()
        )
);
editingContext.objectsWithFetchSpecification(fetchSpec);


NOTE: Your identity qualifier might be like so:

EOEntity entity = EOUtilities.entityForObject(yourEO.editingContext(), yourEO);
EOKeyGlobalID globalID = (EOKeyGlobalID)
eo.editingContext().globalIDForObject(eo);
NSDictionary<String, Object> primaryKey =
entity.primaryKeyForGlobalID(globalID);
EOQualifier identityQualifier = entity.qualifierForPrimaryKey(primaryKey);

profit - save yourself 100 grand.
AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
e:  email@hidden <mailto:email@hidden>  t:  (301) 956-2319



> On Mar 5, 2018, at 2:24 PM, Chuck Hill <email@hidden> wrote:
>
> Hi André,
>
> Invalidating the GlobalIds won’t work.  That will just refresh the objects
> that you have a list of already.  From your description, I think that you
> want to refresh what is in list (get an updated list with inserted and
> deleted rows that match the databse).  This should work
> ERXEOControlUtilities. clearSnapshotForRelationshipNamed(eo, " extWsProjects
> ");
>
> Following that you many need to refault the objects in the relationship.
>
>
>
> On 2018-03-05, 8:31 AM, "Webobjects-dev on behalf of André Rothe"
> <webobjects-dev-bounces+chill=email@hidden
> <mailto:webobjects-dev-bounces+chill=email@hidden> on behalf
> of email@hidden <mailto:email@hidden>>
> wrote:
>
>    Hi,
>
>    I have an EO with a relationship to a second EO. The database in the
>    background will be changed by another application, so it will be
>    necessary to refetch the associated EOs of the relationship on every
>    access.
>
>    How I can invalidate the list of the associated EOs?
>
>    This is the generated method (EOGenerator):
>
>    public NSArray<ExtWsProject> extWsProjects() {
>     // TODO: invalidate this array
>     return (NSArray<ExtWsProject>)storedValueForKey("extWsProjects");
>    }
>
>    On the page
>
> https://en.wikibooks.org/wiki/WebObjects/EOF/Using_EOF/Caching_and_Freshness
>
>    I read something from Jesse Barnum, should I get all the ExtWsProject
>    objects and their GIDs to call ec.invalidateObjectsWithGlobalIDs(ids) to
>    make faults?
>
>    But what about deleted rows in the database, the other application can
>    also delete rows, so the faults should not be necessary?
>
>    Thanks a lot
>    Andre
>
>     _______________________________________________
>    Do not post admin requests to the list. They will be ignored.
>    Webobjects-dev mailing list      (email@hidden)
>    Help/Unsubscribe/Update your Subscription:
>
>
>    This email sent to email@hidden <mailto:email@hidden>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden
> <mailto:email@hidden>)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden <mailto:email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >invalidate relationship cache (From: André Rothe <email@hidden>)
 >Re: invalidate relationship cache (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: invalidate relationship cache
  • Next by Date: Re: invalidate relationship cache
  • Previous by thread: Re: invalidate relationship cache
  • Next by thread: Re: invalidate relationship cache
  • Index(es):
    • Date
    • Thread