From ed53ecda0546d6c639fa3d227a59ace4d57b81a5 Mon Sep 17 00:00:00 2001 From: Upasana Date: Mon, 5 Mar 2018 00:58:41 +0100 Subject: Bug 1273381 - Improve bugzilla object performance by using Class::XSAccessor for object accessors --- Bugzilla/User/APIKey.pm | 12 +++++++++++- Bugzilla/User/Session.pm | 9 ++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'Bugzilla/User') diff --git a/Bugzilla/User/APIKey.pm b/Bugzilla/User/APIKey.pm index c1a4ed572..62121382b 100644 --- a/Bugzilla/User/APIKey.pm +++ b/Bugzilla/User/APIKey.pm @@ -50,7 +50,17 @@ use constant { AUDIT_CREATES => 0, USE_MEMCACHED => 0 }; # Accessors -sub id { return $_[0]->{id} } +############################### +#### Accessors ###### +############################### + +use Class::XSAccessor { + accessors => { + id => __PACKAGE__->ID_FIELD, + name => __PACKAGE__->NAME_FIELD, + }, +}; + sub user_id { return $_[0]->{user_id} } sub api_key { return $_[0]->{api_key} } sub app_id { return $_[0]->{app_id} } diff --git a/Bugzilla/User/Session.pm b/Bugzilla/User/Session.pm index 56e1cd07a..299ed26f7 100644 --- a/Bugzilla/User/Session.pm +++ b/Bugzilla/User/Session.pm @@ -39,7 +39,14 @@ use constant { AUDIT_CREATES => 0, USE_MEMCACHED => 0 }; # Accessors -sub id { return $_[0]->{id} } + +use Class::XSAccessor { + accessors => { + id => __PACKAGE__->ID_FIELD, + name => __PACKAGE__->NAME_FIELD, + }, +}; + sub userid { return $_[0]->{userid} } sub cookie { return $_[0]->{cookie} } sub lastused { return $_[0]->{lastused} } -- cgit v1.2.3-24-g4f1b