Cache issue in OTRS

Moderator: crythias

Locked
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Cache issue in OTRS

Post by GMunjal »

Hi,

We implement OTRS, in which we use to fill the dropdown values from some external data source.

Once the values are filled in dropdown, and if then I add some more value in external data source. these will not reflect till I didn't delete the OTRS cache.

Is there is any way that whenever I update the external database, the same values will be reflected at the same time on UI or on refresh the page.

Any suggestions for this issue.

Thanks
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Cache issue in OTRS

Post by jojo »

you need to alter your script which gets the data to update the cache.
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Cache issue in OTRS

Post by GMunjal »

We create a simple extdata.pl and placed in bin folder which is used to get the external database, is there is any cache related code which cleans up the cache each time ?

below is the extdata.pl code :

Code: Select all

   my %CommonObject = ();
   $CommonObject{ConfigObject} = Kernel::Config->new();
   $CommonObject{EncodeObject} = Kernel::System::Encode->new(%CommonObject);
   $CommonObject{LogObject}    = Kernel::System::Log->new(
    LogPrefix => 'ExtData',
    %CommonObject,
   );
   $CommonObject{MainObject}   = Kernel::System::Main->new(%CommonObject);
   $CommonObject{DBObject}     = Kernel::System::DB->new(
      %CommonObject,
     DatabaseDSN  => 'DBI:ODBC:mssql',
     DatabaseUser => 'temp_test',
     DatabasePw   => 'test11',	
     Type         => 'mssql',
   );


	    	my $query = param('q') || '';
   		my $ResultAsArrayRef = $CommonObject{DBObject}->Prepare
		(
      			SQL => "select languageid from TRN_ODV where name like ?" ,
			Bind => [ \$query],
			Order => 'asc',
     			Limit => 1
   		);

#  my $json_text = to_json($ResultAsArrayRef);
#  print $json_text;
while ( my @Row = $CommonObject{DBObject}->FetchrowArray()) 
{
	 print  $Row[0] ;
}

crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Cache issue in OTRS

Post by crythias »

GMunjal wrote:Once the values are filled in dropdown, and if then I add some more value in external data source. these will not reflect till I didn't delete the OTRS cache.
This doesn't make sense.

The requests to your source data should not be cached.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Cache issue in OTRS

Post by GMunjal »

Yes, you are right, that should not be cached. but in my scenario it is cached, can you explain the way that it must not be cached.
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

Re: Cache issue in OTRS

Post by GMunjal »

Yes, you are right, that should not be cached. but in my scenario it is cached, can you explain the way that it must not be cached.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Cache issue in OTRS

Post by crythias »

You can browse through otrs/bin/otrs.DeleteCache.pl and see what minimal entries you'd need to add the extdata.pl file.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Locked