Allows to remove the cache of theapplication server. This function should be used when you want to obtain non.cached values of functions which returns
values of the cache (because previously it will be removed). For example, the functions of the package table returns values stored in the cache. If any operation
of ddl which modifes struct is performed, it is necessary to remove the cache so that these functions notifies the performed change.
1 system.server.cache.clear
<system.server.cache.clear
type='user|dbms|dbms.table|user.dbms.table'
user='user'
dbms='dbms'
table='table'
/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Atype | string | Indicate the types of cache which has to be removed. | |||
Auser | string | Indicates the user from which the related caches have to be removed. | |||
Adbms | string | Indicates the database from which the related caches have to be removed. | |||
Atable | string | Indicates the table ofwhich the related caches have to be removed. |
Returns | |
---|---|
Type | Description |
int | Returns the number of elements removed of the cache. |
Example
The following example shows how the caches of a specific user are remover from the database and the tables.
Copy
<xsql-script name='system.server.cache.setSQL_sample1'> <body> <!-- Removes the caches of the dpc user and by console is shown the number of removed elements. --> <println> <system.server.cache.clear type='user' user='dpc' /> </println> <!-- Eliminates the caches related with the connection database --> <!-- and by console is shown the number of elements removed. --> <println> <system.server.cache.clear type='dbms' /> </println> <!-- Eliminates the caches related with the acme database --> <!-- and by console is shown the number of elements removed. --> <println> <system.server.cache.clear type='dbms' dbms='acme' /> </println> <!-- Eliminates the caches related with the table capuntes for the connection --> <!-- database and by console is shown the number of elements removed. --> <println> <system.server.cache.clear type='dbms.table' table='capuntes' /> </println> <!-- Eliminates the caches related with the table capuntes of the acme database --> <!-- and by console is shown the number of elements removed. --> <println> <system.server.cache.clear type='dbms.table' dbms='acme' table='capuntes' /> </println> <!-- Eliminates the caches related with the table capuntes of the connection --> <!-- ddatabase, of all the users and by console is shown the number of removed --> <!-- elements. --> <println> <system.server.cache.clear type='user.dbms.table' table='capuntes' /> </println> <!-- Eliminates the caches related with the table capuntes of th acme database --> <!-- of all the users and by console is shown the number of removed elements. --> <println> <system.server.cache.clear type='user.dbms.table' dbms='acme' table='capuntes' /> </println> <!-- Eliminates the caches related with the table capuntes of the acme --> <!-- database, of the dpc user and by console is shown the number of the --> <!-- removed elements. --> <println> <system.server.cache.clear type='user.dbms.table' user='dpc' dbms='acme' table='capuntes' /> </println> </body> </xsql-script>
Example
Eliminates the cache of tables after perform a conversion in a column, to obtain the correct value of its size.
Copy
<xsql-script name='system_cache_setSQL_sample2'> <body> <!-- This operation loads in cache the metadata of the cdiary table. --> <foreach> <select prefix='m_'> <columns>code, namday</columns> <from table='cdiary' /> </select> <do> <println> <m_code />: <m_namday /> </println> </do> </foreach> <!-- Currently in a varchar field (40) --> <println> <table.getColumnLength table='cdiary' column='namday' /> </println> <nativesql> alter table cdiary modify namday varchar(80) </nativesql> <!-- After the conversion it stills indicating that the length is 40, because the value is cached. --> <println> <table.getColumnLength table='cdiary' column='namday' /> </println> <!-- The cache of the database for the table cdiary 8for the same connection bd) is removed --> <system.server.cache.clear type='dbms.table' table='cdiary' /> <!-- Now, after remove the cache indicates that the length is 80. --> <println> <table.getColumnLength table='cdiary' column='namday' /> </println> </body> </xsql-script>