Yii Framework Forum: IdentityMap feature for Active Record - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

IdentityMap feature for Active Record Rate Topic: ***** 4 Votes

#1 User is offline   phpnode 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 18-April 11

Posted 21 September 2011 - 03:21 AM

Rails has recently introduced an identity map feature that ensures that models are loaded only once in a request. This is really useful to maintain consistency, it means you never get multiple instances of the same model floating around in the same request, so it can save a lot of resources if used properly.

I've added a quick implementation here:

https://github.com/p...ter/identitymap

It'd be really nice to have this in the core (although it should be disabled by default). I already opened a feature request for it, but I don't think Qiang sees the advantages of it yet. Does anyone else have any thoughts on the matter?
3

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,341
  • Joined: 12-October 09
  • Location:Croatia

Posted 21 September 2011 - 03:50 AM

And the issue for this is on this link - http://code.google.c...tail?id=2817#c0
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 13 March 2012 - 02:14 PM

Is there any chance this is going to be reconsidered for Yii 2.0? A similar issue has been closed, stating that Yii now supports query caching. But I think query caching solves other problems than an identity map does.
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,374
  • Joined: 17-January 09
  • Location:Russia

Posted 15 March 2012 - 11:40 AM

When we'll show Yii2 code to community you'll be able to test memory consumption to determine if it is necessary.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#5 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 15 March 2012 - 11:56 AM

Yes, certainly. But this doesn't really answer my question :rolleyes: I take it IMs are open for discussion again?
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#6 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,374
  • Joined: 17-January 09
  • Location:Russia

Posted 16 March 2012 - 01:30 PM

What's "IMs"?
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#7 User is offline   Da:Sourcerer 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,222
  • Joined: 30-March 11
  • Location:Berlin, Germany

Posted 16 March 2012 - 01:57 PM

Identity Maps?
programmer /ˈprəʊgramə/, noun: a device that converts ►coffee into ►code
0

#8 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,374
  • Joined: 17-January 09
  • Location:Russia

Posted 20 March 2012 - 07:39 AM

Yes, why not.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#9 User is offline   Thomas Jensen 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 150
  • Joined: 01-August 09

Posted 22 May 2013 - 10:33 AM

I don't think the biggest advantage of IM's are memory onces.
It's the fact that you could be overwriting yourself several times in an app and that this could be a "very hard to debug"-bug that happens occasionally and you might never know about it.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users