Added Settings Buffering for Performance Optimization in Object System (#1032)

- Added buffering of the settings in a settings object in class lcl_persist_settings to buffer the settings  and return them directly, because so far each creation of an object type handler or checking if an object type is supported (which is done by creating an instance of the object type handler) caused a database access to table ZABAPGIT to read and deserialize the settings.
This commit is contained in:
MichaelKaesemann 2017-10-27 10:56:15 +02:00
parent f55fecb4c9
commit caf45545c6

View File

@ -372,8 +372,9 @@ CLASS lcl_persist_settings DEFINITION FINAL.
METHODS read
RETURNING
VALUE(ro_settings) TYPE REF TO lcl_settings.
PRIVATE SECTION.
PRIVATE SECTION.
DATA: mo_settings TYPE REF TO lcl_settings.
ENDCLASS.
@ -1879,15 +1880,30 @@ CLASS lcl_persist_settings IMPLEMENTATION.
METHOD modify.
DATA: settings TYPE string.
settings = io_settings->get_settings_xml( ).
lcl_app=>db( )->modify(
iv_type = lcl_settings=>c_dbtype_settings
iv_value = ''
iv_data = io_settings->get_settings_xml( ) ).
iv_data = settings ).
" Settings have been modified: Update Buffered Settings
IF mo_settings IS BOUND.
mo_settings->set_xml_settings( settings ).
ENDIF.
ENDMETHOD.
METHOD read.
IF mo_settings IS BOUND.
" Return Buffered Settings
ro_settings = mo_settings.
RETURN.
ENDIF.
" Settings have changed or have not yet been loaded
CREATE OBJECT ro_settings.
TRY.
@ -1902,6 +1918,8 @@ CLASS lcl_persist_settings IMPLEMENTATION.
ENDTRY.
mo_settings = ro_settings.
ENDMETHOD.
ENDCLASS.