noxdafox / rabbitmq-message-deduplication

RabbitMQ Plugin for filtering message duplicates
Mozilla Public License 2.0
271 stars 33 forks source link

Correct statement about dropping older entries #100

Closed gaetanww closed 1 year ago

gaetanww commented 1 year ago

Previously the README stated that older entries were removed. The actual behaviour is that an unspecified element is removed from the set.[1]

noxdafox commented 1 year ago

Technically the statement is correct. Once a new cache item is inserted while the cache is full, older elements already present within the cache will be removed to make space. What you are expecting is that the oldest elements are removed and this is indeed not guaranteed.

That said, I can see how the above can be confusing.

Nevertheless, I would not use the term random for two reasons.

What about using:

If the deduplication cache fills up, already existing entries will be removed to give space to new ones.

?

gaetanww commented 1 year ago

Thank you for your quick reply, I agree with you on both counts (i.e., older being technically correct and random being unadapted).

What about using: If the deduplication cache fills up, already existing entries will be removed to give space to new ones. ?

May I suggest If the deduplication cache fills up, unspecified existing entries will be removed to give space to new ones ?

This explicitly carries the information that users of the plugin shouldn't rely on entries being removed in a specific order (in particular., this is not a LRU cache).

noxdafox commented 1 year ago

Sorry for the late reply. That works better, could you please update the PR?

noxdafox commented 1 year ago

Thanks!