Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Is it possible to put multiple key value entries in Distributed cache using putdistributedcache proccessor in nifi?

avatar
 
1 ACCEPTED SOLUTION

avatar
Master Guru

@vinayak krishnan

Yes it's possible but we need to prepare unique values(ex: uuid is unique for each flowfile) for the Cache Entry Identifiers.
Also based on cache update strategy property determines when the already cache entry identifier appears again

Cache update strategyreplace
  • Replace if present Adds the specified entry to the cache, replacing any value that is currently set.
  • Keep original Adds the specified entry to the cache, if the key does not exist.
Determines how the cache is updated if the cache already contains the entry


Property value set to replace then the new value will be replaced to already existing for the cache entry identifier.

Property value set to Keep original then we Adds the specified entry to cache only if the key doesn't exist.

For your reference to this link how to set up unique values for Cache Entry Identifiers.

in the above link i have used update attribute processor to change the filename to UUID and then used ${filename} as Cache Entry Identifier, Like that way you can prepare your attribute (or) use ${UUID()} as the identifier.Then in Fetch Distribute Cache we need to have same key to fetch the cached value for the same identifier.

View solution in original post

1 REPLY 1

avatar
Master Guru

@vinayak krishnan

Yes it's possible but we need to prepare unique values(ex: uuid is unique for each flowfile) for the Cache Entry Identifiers.
Also based on cache update strategy property determines when the already cache entry identifier appears again

Cache update strategyreplace
  • Replace if present Adds the specified entry to the cache, replacing any value that is currently set.
  • Keep original Adds the specified entry to the cache, if the key does not exist.
Determines how the cache is updated if the cache already contains the entry


Property value set to replace then the new value will be replaced to already existing for the cache entry identifier.

Property value set to Keep original then we Adds the specified entry to cache only if the key doesn't exist.

For your reference to this link how to set up unique values for Cache Entry Identifiers.

in the above link i have used update attribute processor to change the filename to UUID and then used ${filename} as Cache Entry Identifier, Like that way you can prepare your attribute (or) use ${UUID()} as the identifier.Then in Fetch Distribute Cache we need to have same key to fetch the cached value for the same identifier.