Hi Sachin, I assume you are using the rocksdb state backend. The TTL for ListState is applied for each list entry, if you are using `ListState.add`. However if you do ListState.update, the entire list is rewrite so the ttl is updated. Could you share your use case and the ttl config? Another suggestion is to use the Map State, thus you could manipulate each entry freely without rewriting the entire list.
Best, Zakelly On Fri, May 30, 2025 at 12:22 AM Sachin Mittal <sjmit...@gmail.com> wrote: > Hi, > I think ttl would be applied for the entire list, > I would like the ListState to restrict the entries by size and > automatically purge older added entries as new ones get added. > Something similar to a bounded list. > > Thanks > Sachin > > > On Thu, May 29, 2025 at 6:51 PM Sigalit Eliazov <e.siga...@gmail.com> > wrote: > >> hi, >> i think you can achieve this by using StateTtlConfig to define the ttl, >> and add ListStateDescriptor to the ListState definition. >> >> thanks, >> Sigalit >> >> >> >> On Thu, May 29, 2025 at 11:53 AM Sachin Mittal <sjmit...@gmail.com> >> wrote: >> >>> Hi, >>> I am adding some hashes of my elements in my list date to check for >>> dedups. >>> >>> Now to not have an infinte growing list, I would like to limit the size >>> of hashes in that list to say a number or just add some TTL config which >>> would expire the entries in the list beyond certain time. >>> >>> Is this something possible using Flink constructs. >>> >>> If not, is there any way I can achieve this ? >>> >>> Thanks >>> Sachin >>> >>>