where/how to dump the garbage in ZF? diy, or somewhere 'in there' already?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

where/how to dump the garbage in ZF? diy, or somewhere 'in there' already?

OpenMacNews-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

hi all,

(since Cal's apparently counting, though i'd fire off 'another one'... ;-)

i'm looking for where to best grab session status & act upon destroying
object-related resources.  not garbage collection of objects themselves,
per se, but of related files.

simple e.g.: i've got a class that dynamically generates image-based
rollover menus.  menu item images are created & written to disk on
demand @ session_id-named dirs.  those images are relvant only for the
duration of the session.  after the session terminates (cleanly or
otherwise), the menu objects themselves are gc'd ok by the destructor,
but i want to delete those files/dirs as well.

i presume one approach is the queue up the object IDs in a session
stack, and conditionally manage them in the controler itself (?).

so where in a ZF front-controller-based pattern will/is/should such
garbage-related collection be managed?

my naiive suspicion is that, currently, it's DIY, and that some
combination of Zend_Session & Zend_Cache (i'kk evtually figure out the
'right' balance between Zend_Cache-to-be, eA & memcached ... ugh) will
be involved ... but i'm guessing.  a grep -i on 'garbage' in src tree
returns null ... :-/

thoughts?

thanks!

richard

- --

/"\
\ /  ASCII Ribbon Campaign
 X   against HTML email, vCards
/ \  & micro$oft attachments

[GPG] OpenMacNews at gmail dot com
fingerprint: 50C9 1C46 2F8F DE42 2EDB  D460 95F7 DDBD 3671 08C6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iEYEAREDAAYFAkRr24kACgkQlffdvTZxCMY9EQCeIW3rjIemv76s1Vp9A1lWtbxV
vzQAnAqkF3/VYBDT5U9C52enOtLeWcYX
=XMb6
-----END PGP SIGNATURE-----

Reply | Threaded
Open this post in threaded view
|

Re: where/how to dump the garbage in ZF? diy, or somewhere 'in there' already?

Terry Cullen
Have a look at __destruct()
public function __destruct()
{
   //delete pictures
}

This will get called automatically when the objects are GCed
Terry

On 5/18/06, OpenMacNews <[hidden email]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
> hi all,
>
> (since Cal's apparently counting, though i'd fire off 'another one'... ;-)
>
> i'm looking for where to best grab session status & act upon destroying
> object-related resources.  not garbage collection of objects themselves,
> per se, but of related files.
>
> simple e.g.: i've got a class that dynamically generates image-based
> rollover menus.  menu item images are created & written to disk on
> demand @ session_id-named dirs.  those images are relvant only for the
> duration of the session.  after the session terminates (cleanly or
> otherwise), the menu objects themselves are gc'd ok by the destructor,
> but i want to delete those files/dirs as well.
>
> i presume one approach is the queue up the object IDs in a session
> stack, and conditionally manage them in the controler itself (?).
>
> so where in a ZF front-controller-based pattern will/is/should such
> garbage-related collection be managed?
>
> my naiive suspicion is that, currently, it's DIY, and that some
> combination of Zend_Session & Zend_Cache (i'kk evtually figure out the
> 'right' balance between Zend_Cache-to-be, eA & memcached ... ugh) will
> be involved ... but i'm guessing.  a grep -i on 'garbage' in src tree
> returns null ... :-/
>
> thoughts?
>
> thanks!
>
> richard
>
> - --
>
> /"\
> \ /  ASCII Ribbon Campaign
>  X   against HTML email, vCards
> / \  & micro$oft attachments
>
> [GPG] OpenMacNews at gmail dot com
> fingerprint: 50C9 1C46 2F8F DE42 2EDB  D460 95F7 DDBD 3671 08C6
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (Darwin)
>
> iEYEAREDAAYFAkRr24kACgkQlffdvTZxCMY9EQCeIW3rjIemv76s1Vp9A1lWtbxV
> vzQAnAqkF3/VYBDT5U9C52enOtLeWcYX
> =XMb6
> -----END PGP SIGNATURE-----
>
>
Reply | Threaded
Open this post in threaded view
|

Re: where/how to dump the garbage in ZF? diy, or somewhere 'in there' already?

OpenMacNews-2
In reply to this post by OpenMacNews-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

hi terry,

> Have a look at __destruct()
> public function __destruct()
> {
>    //delete pictures
> }

well, sure. in the destructor.

thinking about my own question, i'd guess it's as much abt the MVC
pattern as abt ZF implementation ...

are the inidividual page controllers in ZF the 'right' place to
create/destroy view objects?

typically i'd create/ manage a display object in the view, and gc after
the view is existed ... either on entry to another view, or 'later' in a
'parent'.  i presume, in the ZF fc pattern, that's the controller itself?

does it matter in ZF?

richard


- --

/"\
\ /  ASCII Ribbon Campaign
 X   against HTML email, vCards
/ \  & micro$oft attachments

[GPG] OpenMacNews at gmail dot com
fingerprint: 50C9 1C46 2F8F DE42 2EDB  D460 95F7 DDBD 3671 08C6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iEYEAREDAAYFAkRssnsACgkQlffdvTZxCMYY2QCdH7MdRXQRIQ4MHgSue8jY5BUo
paEAni0FRirhdbwQTmiqVj7jEZeHdLGL
=g/Ag
-----END PGP SIGNATURE-----