# How to expire cached category browse paginated pages

**URL:** <https://www.ruby-forum.com/t/how-to-expire-cached-category-browse-paginated-pages/128980>\
**Category:** Rails\
**Created:** [February 13, 2008, 7:43am UTC](https://www.ruby-forum.com/t/how-to-expire-cached-category-browse-paginated-pages/128980 "2008-02-13T07:43:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yaxm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/54ee81/32.png) [@yaxm](https://www.ruby-forum.com/u/yaxm)\
**Post date:** [February 13, 2008, 7:43am UTC](https://www.ruby-forum.com/t/how-to-expire-cached-category-browse-paginated-pages/128980/1 "2008-02-13T07:43:08Z")

</div>

Hi,  
I have a set of categories. Each category has a set of products.

A user can browse by categories. The product listing by category  
provides pagination.

so I am using rails’ fragment cache to cache results like  
/category/computers/page/1, /category/computers/page/2 in Memcached:

unless read\_fragment({:page =\> params[:page] || 1, :category =\>  
params[:category]})

so whenever the system updates a product, I need to expire the related  
category’s product listing pages. But I don’t know which page the  
product belongs to before it’s updated( say the listing is sorted by  
product name, and the product name got updated ). so I don’t know  
which pages to expire.

because of my use of memcached as the caching store, I can’t use the  
regular expression to find caches.

so what’s a solution? keeping track of the page numbers that have been  
viewed?

The last solution I want would be expire caches automatically after like  
10 mins.

Thanks.  
Yaxm
