How can I subscribe for only expired events using dcp clinet?

I’m working with the DCP client in Golang and looking for a method to only listen for expired document keys (DcpExpiration). I want to minimize handling other changes, as my database contains millions of documents, which could result in excessive disk I/O and high network bandwidth usage. How can I accomplish this?

Hi @creddym have you built your own DCP client on top of the framework that gocbcore provides? It’s worth bearing in mind that gocbcore is an unsupported product not intended for public use.

That said, I don’t believe that gocbcore (or in fact the server) provides a way to filter a DCP stream by only expirations.

Hi, I am using this pkg.

Code is simple:
listener := func(ctx *models.ListenerContext) {
switch evt := ctx.Event.(type) {

case models.DcpExpiration:
  log.Printf("[EXPIRED] Document key: %s", string(evt.Key))
  // Handle expired key

case models.DcpDeletion:
  log.Printf("[DELETED] Non-TTL delete key: %s", string(evt.Key))

case models.DcpMutation:
  log.Printf("[MUTATION] Ignored key: %s", string(evt.Key))
}

ctx.Ack()

}

dcpConn, err := dcp.NewDcp(“config.yml”, listener)

I am open to any language that suits my needs. Specifically, I need a list of keys with the prefix “subscriptions::” that have been deleted due to expiration.