CN111611024B - iOS component optimization method, system and terminal - Google Patents

iOS component optimization method, system and terminal Download PDF

Info

Publication number
CN111611024B
CN111611024B CN202010385672.4A CN202010385672A CN111611024B CN 111611024 B CN111611024 B CN 111611024B CN 202010385672 A CN202010385672 A CN 202010385672A CN 111611024 B CN111611024 B CN 111611024B
Authority
CN
China
Prior art keywords
target class
cache
target
name
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010385672.4A
Other languages
Chinese (zh)
Other versions
CN111611024A (en
Inventor
张文浩
尹星
王文波
刘彬
蔡榕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Wanjian Information Technology Co ltd
Original Assignee
Shanghai Wanjian Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Wanjian Information Technology Co ltd filed Critical Shanghai Wanjian Information Technology Co ltd
Priority to CN202010385672.4A priority Critical patent/CN111611024B/en
Publication of CN111611024A publication Critical patent/CN111611024A/en
Application granted granted Critical
Publication of CN111611024B publication Critical patent/CN111611024B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides an iOS (internet operating system) componentization optimization method, a system and a terminal.A user-defined URL (uniform resource locator) verification and routing rule are realized by setting a closure of a configuration class when a Mediator is accessed, and a cache maximum value of the configuration class is set to control a Target class object cache dynamic management logic; when the Target class is created, the essential condition check is realized by following the created protocol and realizing the method stated in the protocol. The iOS componentization optimization method, the system and the terminal can customize functions of URL check logic, routing rules, essential condition check logic and the like of the terminal under the condition of not modifying a Mediator source code; according to the iOS componentization optimization method, the iOS componentization optimization system and the iOS componentization optimization terminal, the media can dynamically clear the cache according to the set cache upper limit, and performance problems are effectively avoided.

Description

iOS component optimization method, system and terminal
Technical Field
The invention relates to the technical field of computer development, in particular to an iOS (internet operating system) componentization optimization method, system and terminal.
Background
In the development process of the application program, with the increase of functions, business logic inevitably becomes more and more complex. In order to avoid the mutual influence among all services, a componentization mode is generally adopted for development, a complex system is split into a plurality of components, and the component boundary and responsibility are separated, so that the independent upgrade and maintenance are facilitated.
The existing Target-Action componentization scheme adopts a Mediator mode, namely all service components realize the communication and interaction among the components by depending on a Mediator:
1. each module creates a Target class of the module according to the format of the Target _ Name;
2. defining an Action method of the Target according to the format of the Action _ Name;
3. by scheme:// [ target ]/[ action ]? The format of [ params ] assembles the URL;
4. the pointer analyzes the Target and the Action in the URL, searches whether a corresponding Target object exists in a cache or not, if so, the Target object is directly used, and if not, the Target object is generated through Runtime;
5. the Mediator sends an Action message to the Tartget object.
In the above componentization scheme, the Mediator does not check the URL, and the URL is parsed using a fixed rule, so that a routing rule customized individually cannot be implemented; the Target cache has no limitation and corresponding cleaning scheme, and the performance problem is easy to occur.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides an iOS (internet operating system) assembly optimization method, a system and a terminal.
The invention is realized by the following technical scheme.
According to an aspect of the present invention, there is provided an iOS componentization optimization method, comprising:
s1, each module creates a Target class according to the naming format of a Target _ Name;
s2, defining and realizing an Action method in the Target class according to the naming format of the Action _ Name;
s3, by scheme:// [ target ]/[ action ]? Assembling the URL in the format of a params, wherein the params represents a parameter set required when the Target class object executes an Action method;
s4, the media analyzes the URL according to the format in the S3, and obtains a Target name, an Action method name and a params parameter set; the process of analyzing the URL comprises the following steps:
creating a global configuration class (MediatorConfiguration) for a Mediator, wherein an object of the configuration class exists as an attribute of the Mediator, declaring a closure as the attribute for the configuration class, realizing self-defined URL (uniform resource locator) verification logic and routing rules, declaring an attribute of a numerical type for the configuration class, and setting a maximum cache value of a Target class object cache dictionary; meanwhile, a statement of a protocol (mediatorperformcirclprotocol) is created in the configuration class, a protocol method is declared, the method returns true or false values, and the essential condition check logic is realized;
s5, the media inquires whether a corresponding Target class object exists in the cache dictionary according to the Target class name:
if yes, directly obtaining;
if not, creating a Target class object through a Runtime program according to the Target class name, and adding the Target class object into a cache dictionary;
s6, the Mediator sends a command for executing the Action method to the Targeted class object and transmits a params parameter set.
Preferably, in S4, the configuration class uses a singleton-pattern design.
Preferably, in S4, for the URL parsing process, before parsing, it is checked whether the configuration class object implements a declarative closure:
if the operation is realized, executing the closure program and returning a Target class name and an Action method name;
if not, executing a default analysis program to obtain the Target class name and the Action method name.
Preferably, in S5, the cache logic of the Target class object adopts a dynamic management logic, which includes:
if the cache is not hit, creating a Target class object through a Runtime program according to the Target class name, adding the Target class object into the cache dictionary, and meanwhile, adding the current time as the latest access time of the Target class object into the cache dictionary and adding the current access times n into the cache dictionary;
if the cache is hit, acquiring the Target class object, and meanwhile, updating the current time serving as the latest access time of the Target class object into the cache dictionary and updating the current access times n +1 into the cache dictionary;
-checking, when adding to the cache, whether the number of caches of the current cache dictionary is greater than or equal to the maximum cache value of the configuration class object:
if so, traversing the current cache dictionary, inquiring the cache object with the longest recent access time and the least access times, and moving the cache object out of the cache;
if not, the cache is not cleaned.
Preferably, in S6, the execution process of the Action method includes:
before executing, checking whether the Target class object acquired in the step S5 follows the created protocol and whether a method stated in the protocol is implemented:
if yes, sending a command for executing the protocol method to the Target class object, judging whether to continue executing the Action method according to a return value executed by the method, executing if the return value is true, and not executing if the return value is false;
if not, directly executing the Action method.
According to another aspect of the present invention, there is provided an iOS componentization optimization system comprising:
the system comprises a Target class creating module, a Target class creating module and a Target class setting module, wherein the Target class creating module is used for creating a Target class of each module according to the naming format of a Target _ Name;
the Action method creating module is used for defining and realizing an Action method according to the naming format of the Action _ Name in the Target class;
a URL assembly module that defines scheme:// [ target ]/[ action ]? [ params ] format, by scheme:// [ target ]/[ action ]? Assembling the URL in the format of a params, wherein the params represents a parameter set required when the Target class object executes an Action method;
the device comprises a media introduction module, a URL assembly module and a parameter collection module, wherein the media introduction module is used for resolving a URL by a media according to a format defined in the URL assembly module and acquiring a Target class name, an Action method name and a params parameter set; in the process of analyzing the URL, a global configuration class (MediatorConfiguration) is created for a Mediator, an object of the configuration class exists as an attribute of the Mediator, a closure is declared for the configuration class as the attribute, custom URL check logic and routing rules are realized, a value type attribute is declared for the configuration class, and the maximum cache value of a Target class object cache dictionary is set; meanwhile, a statement of a protocol (mediatorperformcirclprotocol) is created in the configuration class, a protocol method is declared, the method returns true or false values, and the essential condition check logic is realized;
the device comprises a Target class object creating module, a cache dictionary and a storage module, wherein the Target class object creating module is used for querying whether a corresponding Target class object exists in the cache dictionary by a Mediator according to a Target class name: if yes, directly obtaining; if not, creating a Target class object through a Runtime program according to the Target class name, and adding the Target class object into a cache dictionary;
and the Action method execution module is used for sending a command for executing the Action method to the Targeted object by the media, and transmitting a params parameter set.
Preferably, the Mediator introduces a module in which:
the configuration class is designed by using a singleton mode; and/or
Aiming at the URL analysis process, before analysis, whether the configuration class object realizes the declared closure is checked: if the operation is realized, executing the closure program and returning a Target class name and an Action method name; if not, executing a default analysis program to obtain the Target class name and the Action method name.
Preferably, in the Mediator import module, the cache logic of the Target class object adopts a dynamic management logic.
Preferably, in the Action method execution module, the Action method checks before execution whether the Target class object acquired in the Mediator import module follows the created protocol and whether a method stated in the protocol is implemented: if yes, sending a command for executing the protocol method to the Target class object, judging whether to continue executing the Action method according to a return value executed by the method, executing if the return value is true, and not executing if the return value is false; if not, directly executing the Action method.
According to a third aspect of the present invention, there is provided a terminal comprising a memory, a processor and a computer program stored on the memory and operable on the processor, the processor being operable when executing the computer program to perform any of the methods described above.
According to a fourth aspect of the present invention, there is provided another terminal comprising a memory, a processor, and a system stored on the memory and executable by the processor.
Preferably, the system is operable to perform any of the methods described above.
Compared with the prior art, the invention has the following beneficial effects:
1. according to the iOS componentization optimization method, the iOS componentization optimization system and the iOS componentization optimization terminal, when a Mediator is accessed, user-defined URL (uniform resource locator) verification and routing rules are realized by setting a configuration class closure, and a cache maximum value of the configuration class is set to control Target class object cache dynamic management logic; when a Target class is created, the verification of the essential condition is realized by following the created protocol and realizing the method stated in the protocol; therefore, the invention can customize the functions of URL check logic, routing rule, essential condition check logic and the like without modifying the source code of the Mediator.
2. According to the iOS componentization optimization method, the iOS componentization optimization system and the iOS componentization optimization terminal, the media can dynamically clear the cache according to the set cache upper limit, and performance problems are effectively avoided.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
fig. 1 is a flowchart of an iOS componentization optimization method according to an embodiment of the present invention.
Fig. 2 is a block diagram of an iOS componentization optimization system according to an embodiment of the present invention.
Detailed Description
The following examples illustrate the invention in detail: the embodiment is implemented on the premise of the technical scheme of the invention, and a detailed implementation mode and a specific operation process are given. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.
An embodiment of the present invention provides an iOS componentization optimization method, as shown in fig. 1, including the following steps:
s1, each module creates a Target class according to the naming format of the Target _ Name;
step S1 implements the following functions: the Mediator creates a Target class object according to the incoming Target name and a fixed naming rule;
s2, defining and realizing an Action method according to the naming format of the Action _ Name in the Target;
step S2 implements the following functions: the Mediator acquires an Action method name according to the transmitted Action name and a fixed naming rule, and sends a command for executing the method to the Target object acquired in the step S1;
in step S3, with scheme:// [ target ]/[ action ]? The format of [ params ] assembles the URL; wherein params represents a parameter set required by the Target class object when executing the Action method;
step S3 implements the following functions: when the Mediator sends a command of an execution method to the Target object, a parameter set is transmitted, and when the Action method is executed, required parameters are acquired by analyzing the parameter set;
step S4, the media analyzes the URL according to the format in the step S3, and obtains the Target class name, the Action method name and the params parameter set;
step S5, the Mediator inquires whether a corresponding Target class object exists in a cache dictionary according to the Target class name, if so, the Target class object is directly obtained, and if not, the Target class object is created through a Runtime program according to the Target class name and is added into the cache dictionary;
and S6, the Mediator sends a command for executing the Action method to the Targeted object and transmits a params parameter set.
Wherein:
the URL resolution process (M01) in step S4 includes:
creating a global configuration class (MediatorConfiguration) for the Mediator, wherein an object of the configuration class exists as an attribute of the Mediator, declaring a closure as the attribute for the configuration class, and the attribute is used for realizing self-defined URL check logic and routing rules (see M02), and declaring a value type attribute for the configuration class and used for setting a cache maximum value of a Target class object cache dictionary (used for M03). And creates a declaration of a protocol (mediatorperformcirclprotocol) in the configuration class and declares a protocol method, which returns true or false for implementing the essential condition checking logic (see M04).
The accessor realizes the self-defined URL check logic and the routing rule by encoding the closure of the configuration class.
As a preferred embodiment, the configuration classes created in M01 use a singleton schema design.
As a preferred embodiment, M02 is specifically:
and aiming at the URL analysis process in the step S4, checking whether the configuration class object in the M01 realizes the closure stated in the M01 before analysis, if so, executing a closure program and returning a Target class name and an Action method name, and if not, executing a default analysis program to obtain the Target class name and the Action method name.
As a preferred embodiment, in step S5, adding a cached dynamic management logic (M03) to the caching logic of the Target class object includes:
if the cache is missed, creating a Target class object by a Runtime program according to the Target class name, adding the Target class object into the cache dictionary, adding the current time as the latest access time of the Target class object into the cache dictionary, and adding the current access times (such as 1) into the cache dictionary;
if the cache is hit, acquiring the Target class object, and updating the current time into the cache dictionary as the latest access time of the Target class object, and updating the current access times +1 (such as 1+1) into the cache dictionary;
when the cache is added, checking whether the cache number of the current cache dictionary is greater than or equal to the maximum cache value of the configuration class objects in M01, if so, traversing the current cache dictionary, querying the cache object with the longest recent access time and the least access times, and moving the cache object out of the cache; if not, the cache is not cleaned.
As a preferred embodiment, in step S6, the execution process (M04) of the Action method includes:
aiming at the execution process of the Action method of S06, before the execution, whether the Target class object obtained in S05 follows the protocol stated in M01 and whether the method stated in the protocol is realized is checked, if yes, a command for executing the protocol method is sent to the Target class object, whether the Action method is continuously executed is judged according to the return value executed by the method, and if the return is returned to the future, the execution is carried out, and if the return is returned to the false, the execution is not carried out; if not, directly executing the Action method.
The iOS componentization optimization method provided by the embodiment of the present invention is further described in detail below with reference to a specific application example.
In an iOS App, the following componentization scheme needs to be completed:
1. the development of a module A (Module A) is realized;
2. the module A respectively provides a method B (ActionB), a method C (ActionC) and a method D (ActionD) for acquiring the page 1, the page 2 and the page 3;
3. the method of calling module A must be logged in;
4. is there a scheme:// startapp/module a/[ action ]? URL format access module A of [ params ];
5. the maximum value of the Target class object cache is 10;
in combination with the iOS componentization optimization method provided by the embodiment of the present invention, the componentization method comprises the following implementation steps:
1. introducing mediators and a configuration class (MediatorConfiguration) created in M01;
2. creating a Target class (Target _ ModuleA) belonging to a module A, and declaring a realization method B (Action _ ActionB), a method C (Action _ ActionC) and a method D (Action _ ActionD);
3. the Target class (Target _ module a) follows the protocol (mediatorperformcirclprotocol) declared in M01, and implements the method declared in the protocol (specifically, the method is implemented by determining whether a user logs in, logs in and returns a tube, and does not log in and returns a false), here, in order to implement requirement 3 (i.e., the requirement condition is verified, and the working process is shown in M04);
4. when App starts, a singleton object of a configuration class (MediatorConfiguration) is obtained, and implementation of a closure attribute (that is, implementation of a URL agreed in a resolution requirement 4 is set, and a Target class name and an Action method name obtained by resolution are returned), wherein in order to implement the requirement 4 (that is, a self-defined routing rule, a working process is shown in M02);
5. when App starts, acquiring a singleton object of a configuration class (MediatorConfiguration), setting the maximum cache attribute of the singleton object to be 10, and realizing a requirement 5 (see a working process M03) here;
6. so far, the above requirements are realized, and the module A can be accessed through the Mediator according to the URL format agreed by the requirements.
Based on the iOS componentization optimization method provided by the embodiment of the present invention, the embodiment of the present invention also provides an iOS componentization optimization system, as shown in fig. 2, including:
the system comprises a Target class creating module, a Target class creating module and a Target class setting module, wherein the Target class creating module is used for each module to create own Target class according to the naming format of Target _ Name;
the Action method creating module is used for defining and realizing an Action method according to the naming format of the Action _ Name in the Target class;
a URL assembly module that defines scheme:// [ target ]/[ action ]? [ params ] format, by scheme:// [ target ]/[ action ]? Assembling the URL in the format of a params, wherein the params represents a parameter set required when the Target class object executes an Action method;
the device comprises a media introduction module, a URL assembly module and a parameter collection module, wherein the media introduction module is used for analyzing a URL by the media according to a format defined in the URL assembly module and acquiring a Target class name, an Action method name and a params parameter set; in the process of analyzing the URL, a global configuration class (MediatorConfiguration) is created for a Mediator, an object of the configuration class exists as an attribute of the Mediator, a closure is declared for the configuration class as an attribute, the attribute is used for realizing self-defined URL check logic and routing rules, a value type attribute is declared for the configuration class, and the maximum cache value of a Target class object cache dictionary is set; meanwhile, a statement of a protocol (mediatorperformcirclprotocol) is created in the configuration class, a protocol method is declared, the method returns true or false values, and the essential condition check logic is realized;
the device comprises a Target class object creating module, wherein the Target class object creating module is used for querying whether a corresponding Target class object exists in a cache dictionary by a media player according to a Target class name: if yes, directly obtaining; if not, creating a Target class object through a Runtime program according to the Target class name, and adding the Target class object into a cache dictionary;
and the Action method execution module is used for sending a command for executing the Action method to the Targeted object by the media, and transmitting a params parameter set.
Further, the iOS componentization optimization system may be configured to perform the iOS componentization optimization method.
As a preferred embodiment, the Mediator introduces into the module:
the configuration class is designed by using a singleton mode; and/or
Aiming at the URL analysis process, before analysis, whether the configuration class object realizes the declared closure is checked: if the method is realized, executing the closure program and returning the Target class name and the Action method name; if not, executing a default analysis program to obtain the Target class name and the Action method name.
In a preferred embodiment, in the media import module, the cache logic of the Target class object adopts a dynamic management logic.
As a preferred embodiment, in the Action method execution module, before execution, the Action method checks whether a Target class object acquired in the Mediator introduction module follows a created protocol, and whether a method declared in the protocol is implemented: if yes, sending a command for executing the protocol method to the Target class object, judging whether to continue executing the Action method according to a return value executed by the method, executing if the return value is true, and not executing if the return value is false; if not, directly executing the Action method.
Based on the iOS componentization optimization method provided by the embodiment of the present invention, the embodiment of the present invention also provides a terminal, which includes a memory, a processor, and a computer program stored on the memory and capable of running on the processor, and the processor can be used to execute any of the iOS componentization optimization methods described above when executing the computer program.
Optionally, a memory for storing a program; a Memory, which may include a volatile Memory (RAM), such as a Random Access Memory (SRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), and the like; the memory may also comprise a non-volatile memory, such as a flash memory. The memory 62 is used to store computer programs (e.g., applications, functional modules, etc. that implement the above-described methods), computer instructions, etc., which may be stored in one or more memories in a partitioned manner. And the computer programs, computer instructions, data, etc. described above may be invoked by a processor.
The computer programs, computer instructions, etc. described above may be stored in one or more memories in a partitioned manner. And the computer programs, computer instructions, data, etc. described above may be invoked by a processor.
A processor for executing the computer program stored in the memory to implement the steps of the method according to the above embodiments. Reference may be made in particular to the description relating to the preceding method embodiment.
The processor and the memory may be separate structures or may be an integrated structure integrated together. When the processor and the memory are separate structures, the memory, the processor may be coupled by a bus.
Based on the iOS componentization optimization method provided by the embodiment of the present invention, the embodiment of the present invention also provides another terminal, which comprises a memory, a processor, and an iOS componentization optimization system that is stored on the memory and can run any one of the above through the processor.
Further, the iOS componentization optimization system can be used to perform the iOS componentization optimization method.
When the iOS componentization optimization method, system, and terminal provided in the above embodiments of the present invention access the Mediator, the custom URL check and routing rule is realized by setting the closure of the configuration class (see M02 in the execution process), and the cache maximum value of the configuration class is set to control the Target class object cache dynamic management logic (see M03 in the execution process); when the media is accessed, custom URL verification and routing rules are realized by setting a closure of a configuration class (see M02 in the execution process), and a cache maximum value of the configuration class is set to control a Target class object cache dynamic management logic (see M03 in the execution process); therefore, the invention can customize the functions of URL check logic, routing rule, essential condition check logic and the like without modifying the source code of the Mediator.
According to the iOS componentization optimization method, the iOS componentization optimization system and the iOS componentization optimization terminal, the media can dynamically clear the cache according to the set cache upper limit, and performance problems are effectively avoided.
It should be noted that, the steps in the method provided by the present invention can be implemented by using corresponding modules, devices, units, and the like in the system, and those skilled in the art can implement the step flow of the method by referring to the technical scheme of the system, that is, the embodiment in the system can be understood as a preferred example of the implementation method, and details are not described herein.
Those skilled in the art will appreciate that, in addition to implementing the system and its various devices provided by the present invention in purely computer readable program code means, the method steps can be fully programmed to implement the same functions by implementing the system and its various devices in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Therefore, the system and various devices thereof provided by the present invention can be regarded as a hardware component, and the devices included in the system and various devices thereof for realizing various functions can also be regarded as structures in the hardware component; means for performing the various functions may also be conceived of as structures within both software modules and hardware components of the illustrated method.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention.

Claims (10)

1. An iOS componentization optimization method, comprising:
s1, each module creates a Target class according to the naming format of a Target _ Name;
s2, defining and realizing an Action method according to the naming format of the Action _ Name in the Target class;
s3, by scheme:// [ target ]/[ action ]? Assembling the URL in the format of a params, wherein the params represents a parameter set required when the Target class object executes an Action method;
s4, the media analyzes the URL according to the format in the S3 to obtain a Target class name, an Action method name and a params parameter set; the process of analyzing the URL comprises the following steps:
creating a global configuration class for a Mediator, wherein an object of the configuration class exists as an attribute of the Mediator, declaring a closure as the attribute for the configuration class, realizing a custom URL check logic and a routing rule, declaring an attribute of a numerical type for the configuration class, and setting a maximum cache value of a Target class object cache dictionary; meanwhile, a protocol statement is created in the configuration class, a protocol method is declared, and the method returns a true or false value to realize the essential condition check logic;
s5, the media inquires whether a corresponding Target class object exists in the cache dictionary according to the Target class name:
if yes, directly obtaining;
if not, creating a Target class object through a Runtime program according to the Target class name, and adding the Target class object into a cache dictionary;
s6, the Mediator sends a command for executing the Action method to the Targeted class object and transmits a params parameter set.
2. The iOS componentization optimization method of claim 1, wherein in S4, a configuration class uses a singleton-pattern design.
3. The iOS componentization optimization method of claim 1, wherein in S4, for the URL parsing process, it is checked whether the configuration class object implements a declared closure before parsing:
if the operation is realized, executing the closure program and returning a Target class name and an Action method name;
if not, executing a default analysis program to obtain the Target class name and the Action method name.
4. The iOS componentization optimization method according to claim 1, wherein in S5, the caching logic of the Target class object adopts a dynamic management logic, which includes:
if the cache is not hit, creating a Target class object through a Runtime program according to the Target class name, adding the Target class object into the cache dictionary, and meanwhile, adding the current time as the latest access time of the Target class object into the cache dictionary and adding the current access times n into the cache dictionary;
if the cache is hit, acquiring the Target class object, and meanwhile, updating the current time serving as the latest access time of the Target class object into the cache dictionary and updating the current access times n +1 into the cache dictionary;
-checking, when adding to the cache, whether the number of caches of the current cache dictionary is greater than or equal to the maximum cache value of the configuration class object:
if so, traversing the current cache dictionary, inquiring the cache object with the longest recent access time and the least access times, and moving the cache object out of the cache;
if not, the cache is not cleaned.
5. The iOS componentization optimization method according to claim 1, wherein in S6, an execution process of the Action method includes:
before executing, checking whether the Target class object acquired in the step S5 follows the created protocol and whether a method stated in the protocol is implemented:
if yes, sending a command for executing the protocol method to the Target class object, judging whether to continue executing the Action method according to a return value executed by the method, executing if the return value is true, and not executing if the return value is false;
if not, directly executing the Action method.
6. An iOS componentized optimization system, comprising:
the system comprises a Target class creating module, a Target class setting module and a Target class setting module, wherein the Target class creating module is used for creating a Target class of each module according to the naming format of a Target _ Name;
the Action method creating module is used for defining and realizing an Action method according to the naming format of the Action _ Name in the Target class;
a URL assembly module that defines scheme:// [ target ]/[ action ]? [ params ] format, by scheme:// [ target ]/[ action ]? Assembling the URL in the format of a params, wherein the params represents a parameter set required when the Target class object executes an Action method;
the device comprises a media introduction module, a URL assembly module and a parameter collection module, wherein the media introduction module is used for resolving a URL by a media according to a format defined in the URL assembly module and acquiring a Target class name, an Action method name and a params parameter set; in the process of analyzing the URL, a global configuration class (MediatorConfiguration) is established for a Mediator, an object of the configuration class exists as an attribute of the Mediator, a closure is declared for the configuration class as the attribute, custom URL check logic and routing rules are realized, a value type attribute is declared for the configuration class, and the maximum cache value of a Target class object cache dictionary is set; meanwhile, a statement of a protocol (mediatorPerformCirclrepocol) is established in the configuration class, a protocol method is declared, and the method returns a true or false value to realize the essential condition check logic;
the device comprises a Target class object creating module, a cache dictionary and a storage module, wherein the Target class object creating module is used for querying whether a corresponding Target class object exists in the cache dictionary by a Mediator according to a Target class name: if yes, directly obtaining; if not, creating a Target class object through a Runtime program according to the Target class name, and adding the Target class object into a cache dictionary;
and the Action method execution module is used for sending a command for executing the Action method to the Targeted object by the media, and transmitting a params parameter set.
7. The iOS componentized optimization system of claim 6, wherein the Mediator lead-in module is configured to:
the configuration class is designed by using a singleton mode; and/or
Aiming at the URL analysis process, before analysis, whether the configuration class object realizes the declared closure is checked: if the operation is realized, executing the closure program and returning a Target class name and an Action method name; if not, executing a default analysis program to obtain the Target class name and the Action method name.
8. The iOS componentization optimization system of claim 6, wherein, in the Mediator lead-in module, a dynamic management logic is employed for the caching logic of the Target class object.
9. The iOS componentized optimization system according to claim 6, wherein in the Action method execution module, the Action method checks before execution whether the Target class object acquired in the Mediator lead-in module follows the created protocol and implements a method declared in the protocol: if yes, sending a command for executing the protocol method to the Target class object, judging whether to continue executing the Action method according to a return value executed by the method, if the return value is true, executing, and if the return value is false, not executing; if not, directly executing the Action method.
10. A terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the computer program, is operable to perform the method of any of the preceding claims 1 to 5.
CN202010385672.4A 2020-05-09 2020-05-09 iOS component optimization method, system and terminal Active CN111611024B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010385672.4A CN111611024B (en) 2020-05-09 2020-05-09 iOS component optimization method, system and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010385672.4A CN111611024B (en) 2020-05-09 2020-05-09 iOS component optimization method, system and terminal

Publications (2)

Publication Number Publication Date
CN111611024A CN111611024A (en) 2020-09-01
CN111611024B true CN111611024B (en) 2022-10-11

Family

ID=72200093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010385672.4A Active CN111611024B (en) 2020-05-09 2020-05-09 iOS component optimization method, system and terminal

Country Status (1)

Country Link
CN (1) CN111611024B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6012067A (en) * 1998-03-02 2000-01-04 Sarkar; Shyam Sundar Method and apparatus for storing and manipulating objects in a plurality of relational data managers on the web
CN1630853A (en) * 2001-10-30 2005-06-22 皇家飞利浦电子股份有限公司 Method for constructing distributed software components
EP1898553A1 (en) * 2006-08-31 2008-03-12 Nokia Siemens Networks Gmbh & Co. Kg Generic network configuration management with XML
US9432484B1 (en) * 2013-12-19 2016-08-30 Emc Corporation CIM-based data storage management system having a restful front-end
CN107707614A (en) * 2017-08-16 2018-02-16 深圳市丰巢科技有限公司 App route implementation methods, equipment and the storage medium of agreement are jumped based on system
CN108255495A (en) * 2018-01-31 2018-07-06 中国银行股份有限公司 A kind of modularization method and system based on Mediator
WO2018170504A1 (en) * 2017-03-17 2018-09-20 Labyrinth Research Llc Unified control of privacy-impacting devices
CN109643277A (en) * 2016-09-26 2019-04-16 英特尔公司 The device and method merged for intermediary's transmitting and shared memory page
CN109669786A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Interface call method, unit and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060155830A1 (en) * 2004-11-12 2006-07-13 International Business Machines Corporation Configuration mediator for a multi-component software solution environment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6012067A (en) * 1998-03-02 2000-01-04 Sarkar; Shyam Sundar Method and apparatus for storing and manipulating objects in a plurality of relational data managers on the web
CN1630853A (en) * 2001-10-30 2005-06-22 皇家飞利浦电子股份有限公司 Method for constructing distributed software components
EP1898553A1 (en) * 2006-08-31 2008-03-12 Nokia Siemens Networks Gmbh & Co. Kg Generic network configuration management with XML
US9432484B1 (en) * 2013-12-19 2016-08-30 Emc Corporation CIM-based data storage management system having a restful front-end
CN109643277A (en) * 2016-09-26 2019-04-16 英特尔公司 The device and method merged for intermediary's transmitting and shared memory page
WO2018170504A1 (en) * 2017-03-17 2018-09-20 Labyrinth Research Llc Unified control of privacy-impacting devices
CN107707614A (en) * 2017-08-16 2018-02-16 深圳市丰巢科技有限公司 App route implementation methods, equipment and the storage medium of agreement are jumped based on system
CN108255495A (en) * 2018-01-31 2018-07-06 中国银行股份有限公司 A kind of modularization method and system based on Mediator
CN109669786A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Interface call method, unit and computer readable storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Building mediators from components;J. Todd ET AL;《Proceedings of the International Symposium on Distributed Objects and Applications》;20020806;全文 *
Mediator模型的SystemC代码自动生成;张琦等;《计算机工程与科学》;20190515(第05期);全文 *
基于Mediator模式的参数控制法;王子敬等;《江南大学学报(自然科学版)》;20060430(第02期);全文 *
设计模式在水文信息推送APP架构设计中的应用;周波等;《长江工程职业技术学院学报》;20171220(第04期);全文 *

Also Published As

Publication number Publication date
CN111611024A (en) 2020-09-01

Similar Documents

Publication Publication Date Title
US11176160B2 (en) SQL interceptor for use with third party data analytics packages
EP1872215B1 (en) Implementing data-compatibility-based version scheme
US20060020689A1 (en) Index-based parameter access and software for using the same
US20180285470A1 (en) A Mobile Web Cache Optimization Method Based on HTML5 Application Caching
CN111800459A (en) Asynchronous processing method, device and system for download task and storage medium
CN109725923A (en) A kind of software light weight update method, device and equipment
CN109597618B (en) Program development method, program development device, computer device, and storage medium
CN112154420A (en) Automatic intelligent cloud service testing tool
CN103164193A (en) Method and device for template rendering
CN112015752A (en) Method and device for dynamically querying data, electronic equipment and storage medium
CN105095367A (en) Method and device for acquiring client data
CN112486789A (en) Log analysis system, method and device
EP1704475B1 (en) System and method for dynamically optimized message processing
CN111240772A (en) Data processing method and device based on block chain and storage medium
CN111611024B (en) iOS component optimization method, system and terminal
CN113608742A (en) Detection method, code packet processing method, operation control method and computing device
CN111767053A (en) Front-end page data acquisition method and device
CN106383869A (en) User behavior information acquisition method and device
CN115374083A (en) Data source switching method and device, electronic equipment and storage medium
CN112860235B (en) Method, device, equipment and storage medium for processing text
Chiang et al. Two-stage diff: An efficient dynamic software update mechanism for wireless sensor networks
CN112650502A (en) Batch processing task processing method and device, computer equipment and storage medium
CN108089852B (en) Method, medium, apparatus and computing device for establishing attribute access
CN112612474A (en) Product transplanting method and device, storage medium and electronic equipment
CN106570143B (en) Method and device for sending response object

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant