If you need a 2nd copy of a singleton, can you just duplicate it?

Hi,

I have an object that is a singleton within the context of a website.

Within the context of a scheduled task, I want a 2nd copy of that
object to work with because I'll be changing its behavior within the
scheduled task but don't want to change the behavior of the singleton
on the website.

From some tests, it seems that if I duplicate() the singleton in my
scheduled task, I can modify its behavior without affecting the one of
the site.

Just wondering if there's a better way to do this or a coldbox way to
accomplish the same thing? Or is duplicate() appropriate?

Thank you,
Gabriel

I would completely discourage you from duplication. Why not use the
wirebox binder and wire the same Cfc into two aliases with diff
behavior.

Mapping it twice gives me two copies of the object (which is good) but
it doesn't gives copies of the dependencies of that object (which is
what causes my problem).

Duplicate() is giving me a true clone independent of the original,
dependencies and all.

- Gabriel