I was just wondering if it was possible to update the value of a key in the Mage::registry without unsetting and resetting the item in the registry.


$ids = array('1', '2', '3');
Mage::register('testing-key', $ids);

$re_ids = Mage::registry('testing-key');
$re_ids[] = '4';

Mage::registry('testing-key') = $re_ids;

No, unfortunately, the Mage class only provides three different methods to deal with the registry:

  • register
  • unregister
  • registry

Thus, you will have to call unregister then register again if you want to update an entry in the registry.

  • Is there a way to lock a registry item? What I mean is that say there's a process that multiple users can go through at the same time, but it uses the same registry item. I want only 1 users to be able to read, unregister and re-register an item at a time. Sorry if these questions seem dumb, I'm trying to find the best solution to a problem, and trying as many different solutions as I can to find the best one :) – Skytiger Apr 25 '16 at 8:50
  • 1
    @Skytiger well that's an entire different question. I suggest you mark this one as answered and open a new question with the comment you just made. – Raphael at Digital Pianism Apr 25 '16 at 8:52
  • Thanks, I'll create a new question for it. Was just waiting for the timer to run out so that I could mark this as answered :) – Skytiger Apr 25 '16 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.