Creating your own widgets: using cache?

take a look at WordPress Transients API

which offers a simple and standardized way of storing cached data in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted.

The transients API is very similar to
the Options API but with the added
feature of an expiration time, which
simplifies the process of using the
wp_options database table to store
cached information.