NAME MooseX::AutoDestruct - Clear your attributes after a certain time VERSION version 0.008 SYNOPSIS package Foo; use Moose; use namespace::autoclean; use MooseX::AutoDestruct; has foo => ( traits => ['AutoDestruct'], is => 'ro', isa => 'Str', lazy_build => 1, ttl => 600, # time, in seconds ); sub _build_foo { --some expensive operation-- } DESCRIPTION MooseX::AutoDestruct is an attribute metaclass trait that causes your attribute value to be cleared after a certain time from when the value has been set. This trait will work regardless of how the value is populated or if a clearer method has been installed; or if the value is accessed via the installed accessors or by accessing the attribute metaclass itself. TRAITS APPLIED No traits are automatically applied to any metaclasses; however, on use'ing this package an 'AutoDestruct' attribute trait becomes available. USAGE Apply the AutoDestruct trait to your attribute metaclass (e.g. "traits => ['AutoDestruct']") and supply a ttl value. Typical usage of this could be for an attribute to store a value that is expensive to calculate, and can be counted on to be valid for a certain amount of time (e.g. caching). Builders are your friends :) SEE ALSO Class::MOP, Moose. AUTHOR Chris Weyl, "" BUGS Please report any bugs or feature requests to "bug-moosex-autodestruct at rt.cpan.org", or through the web interface at . AUTHOR Chris Weyl COPYRIGHT AND LICENSE This software is Copyright (c) 2011 by Chris Weyl. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999