1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-22 09:12:19 -05:00

Add cache invalidation to entity versioning

This commit is contained in:
Sam Whited 2015-09-01 19:54:32 -05:00 committed by Matthew A. Miller
parent 796a7a4d94
commit f7eb0a8a8c

View File

@ -52,9 +52,13 @@
which was later merged into &rfc6121; §2.6. While this solved the problem which was later merged into &rfc6121; §2.6. While this solved the problem
for the roster, it didn't account for other entities (eg. disco items). for the roster, it didn't account for other entities (eg. disco items).
Furthermore, roster versioning requires that the server maintain a great Furthermore, roster versioning requires that the server maintain a great
deal of state (multiple versions of the roster) which can be difficult to deal of state (roster items which should be pushed for each entity on
implement in a large, distributed system. This XEP defines a method by reconnect, or monotonically increasing counters, etc.) which can be
which entities other than the roster can be versioned and cached. difficult to store or synchronize in a large, distributed system. This XEP
defines a method by which the roster and entities other than the roster can
be versioned and cached, and which is optimized for distributed systems
with large enity lists (but works equally well on small, single server
deployments).
</p> </p>
</section1> </section1>
@ -268,6 +272,51 @@
question when a version token is received. question when a version token is received.
</p> </p>
</section2> </section2>
<section2 topic='Cache Invalidation' anchor='deletes'>
<p>
When a client syncs with the server and indicates that it has a version
token in its cache that does not match any entity on the server (or when
the server wants to remove an entity from the clients cache for any other
reason), the server MUST reply with an empty &lt;version/&gt; node. When
the client receives such an empty version node it SHOULD purge the entity
from its cache. For example, the following exchange would trigger the
removal of 'inverness@chat.shakespeare.lit' from the cached MUC list:
<example caption="MUC deletion"><![CDATA[
<!-- Client -->
<iq from='hag66@shakespeare.lit/phone'
id='zb8q41fas6yn4'
to='chat.shakespeare.lit'
type='get'>
<query xmlns='http://jabber.org/protocol/disco#items>
<item jid='coven@chat.shakespeare.lit'>
<version xmlns='urn:xmpp:entityver:0'>25P2A7H8</version>
</item>
<item jid='inverness@chat.shakespeare.lit'>
<version xmlns='urn:xmpp:entityver:0'>4OLGSVNY</version>
</item>
</query>
</iq>
<!-- Server -->
<iq from='chat.shakespeare.lit'
id='zb8q41fas6yn4'
to='hag66@shakespeare.lit/phone'
type='result'>
<query xmlns='http://jabber.org/protocol/disco#items'>
<item jid='inverness@chat.shakespeare.lit'>
<version xmlns='urn:xmpp:entityver:0'/>
</item>
</query>
</iq>
]]></example>
</p>
<p>
If the client receives an indication that it should delete an item from a
list by any other means (eg. via a roster push), it SHOULD remove the
version token associated with that entity from its cache.
</p>
</section2>
<section2 topic='Aggregate Tokens' anchor='agg_tokens'> <section2 topic='Aggregate Tokens' anchor='agg_tokens'>
<p> <p>
While the version token approach to caching does not require a great deal While the version token approach to caching does not require a great deal